Skip to content

feat(autocomplete): Automatically close (resp. open) the panel when the triggering 'input' is no longer visible (becomes visible again) #23343

Open
@tinesoft

Description

@tinesoft

Feature Description

Currently, when the input element that triggered the opening of the dropdown panel is no longer visible in the viewport (after a scroll up or down), the panel remains still visible, which is weird, as it appears "floating around in the air" and no longer "attached" to its peer input.

Before scrolling up
image

After scrolling up (the triggering 'Assignee' input is now off the viewport, higher up)
image

Using the Intersection Observer API, we could determine is the input is still visible inside the Viewport, and close the panel if it is not.

Additionally, when the input becomes visible again, if the input element still has focus, we could open the panel again.

Use Case

When using the Matautocomplete panel inside a scrollable container and that the input can become visible/hidden after scrolling the viewport

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: cdk/overlayarea: material/autocompletefeatureThis issue represents a new feature or feature request rather than a bug or bug fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions