Skip to content

fix(ui): prevent Combobox search-filtered entries from losing click events#15788

Open
silmin wants to merge 1 commit intopayloadcms:mainfrom
silmin:fix/combobox-search-selection
Open

fix(ui): prevent Combobox search-filtered entries from losing click events#15788
silmin wants to merge 1 commit intopayloadcms:mainfrom
silmin:fix/combobox-search-selection

Conversation

@silmin
Copy link

@silmin silmin commented Feb 27, 2026

What?

When using the Combobox with search filtering (e.g. CodeBlock language selector), clicking a filtered entry closes the popup but doesn't trigger onSelect. Without filtering, selection works correctly.

image

Why?

The Popup's handleActionableClick listener detects the [role="menuitem"] click and closes the popup, which calls setSearchValue('') via onToggleClose.
This rebuilds the entry list, removing the clicked DOM node before React's synthetic onClick can fire.

How?

The fix adds data-popup-prevent-close to Combobox entry divs.
Popup already checks for this attribute in handleActionableClick (Popup/index.tsx L323-324) and skips auto-closing, letting the Combobox's own handleClick handle both selection and closing.

One-line change in packages/ui/src/elements/Combobox/index.tsx.

@silmin silmin changed the title fix(ui): prevent Combobox search-filtered entries from losing click events fix(ui): prevent Combobox search-filtered entries from losing click events Feb 27, 2026
@silmin
Copy link
Author

silmin commented Feb 28, 2026

@jacobsfletch @AlessioGr @JarrodMFlesch
Hi wonderful maintainers,

Just a gentle ping on this PR. Has anyone had a chance to take a look?

I am currently working around this issue in my local environment using pnpm patch, but I believe this fix would be very helpful for everyone else using the Combobox component.

I would really appreciate it if you could review this when you have some time. Thank you!

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.

1 participant