Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent closing the Combobox component when clicking inside the scrollbar area #3104

Merged
merged 2 commits into from
Apr 16, 2024

Conversation

RobinMalfait
Copy link
Member

This PR ensures that clicking inside the scrollbar area of the ComboboxOptions does not close the Combobox.

The main issue (see #3071) is that clicking inside the scrollbar area moves focus into the TabPanel which blurs the ComboboxInput and in turn closes the Combobox.

Preventing the default behavior of the mousedown event when clicking inside the scrollbar area of the ComboboxOptions prevents the focus from moving to the TabPanel and keeps the Combobox open.

Fixes: #3071

Copy link

vercel bot commented Apr 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 16, 2024 3:31pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 16, 2024 3:31pm

@RobinMalfait RobinMalfait merged commit 9f44656 into main Apr 16, 2024
8 checks passed
@RobinMalfait RobinMalfait deleted the fix/issue-3071 branch April 16, 2024 15:35
RobinMalfait added a commit that referenced this pull request Apr 16, 2024
…ollbar area (#3104)

* prevent closing `Combobox` when clicking inside the scrollbar area

* update changelog
@Propaganistas
Copy link

Propaganistas commented Oct 15, 2024

@RobinMalfait This PR breaks the following scenario: a Combobox with an input field inside. When I now click the input field, the click is now regarded as a ComboboxOption selection instead of just focusing the input field.

screenshot

In 1.7.20 the following code used to work, but starting from 1.7.21 it broke.
Scherm­afbeelding 2024-10-15 om 20 04 16

Removing the enclosing ComboboxOption component also doesn't work. The input field cannot be focused because the ancestor ComboboxOptions is now catching mouse clicks alltogether...

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.

Can not use the combobox scrollbar inside the Tab or Radio Group components
3 participants