Skip to content

fix(select): keep the panel open when an option in a nested overlay is picked - #732

Open
tokainz wants to merge 2 commits into
openvi-foundation:masterfrom
tokainz:fix/select-nested-overlay-click
Open

tokainz wants to merge 2 commits into
openvi-foundation:masterfrom
tokainz:fix/select-nested-overlay-click

Conversation

@tokainz

@tokainz tokainz commented Nov 19, 2026

Copy link
Copy Markdown

What does this PR do?

A Select in the header or footer slot of another Select closed the outer Select when you picked one of its options. The panel of the inner Select is attached to body, so the outside click listener of the outer Select treated the click as an outside click.

This applies the same fix as in DatePicker (#571), MultiSelect (#718) and AutoComplete (#721):

  • The Select listens to overlay-click while its panel is open. If the event comes from a component inside its panel, it sets selfClick and ignores the following outside click. Select emits overlay-click on mousedown, so this also works when the inner Select has already closed by the time the click event arrives.
  • isNestedOverlayVisible() checks for an open overlay inside the panel ([aria-expanded="true"]). While the inner Select is open, a click outside closes only the inner Select. A second click closes the outer one.

The listener is removed in onOverlayLeave and beforeUnmount. Since Select has no isOutsideClicked() method, both checks are added to the existing composedPath condition in the outside click listener.

Tests: added a nested overlays block to Select.spec.js with the same 5 tests as for MultiSelect and AutoComplete. Without the fix, 2 of them fail.

Verified manually in the showcase with a Select in the header of another Select. Picking an option of the outer Select itself still selects it and closes the panel as before.

Related issue

Closes #731

Checklist

  • Tests added or updated for the change
  • pnpm run lint and pnpm run format pass
  • Changelog entry added under ## [Unreleased] in CHANGELOG.md

@vercel

vercel Bot commented Nov 19, 2026

Copy link
Copy Markdown

@tokainz is attempting to deploy a commit to the njevric's projects Team on Vercel.

A member of the Team first needs to authorize it.

@tokainz
tokainz force-pushed the fix/select-nested-overlay-click branch from f03f2e9 to cacb6c8 Compare November 20, 2026 21:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Select closes when you pick an option in a Select placed in its header or footer

1 participant