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

Feature request: allow disabling the "clicking outside" mouse handler #1632

Open
qbtf opened this issue Jan 4, 2025 · 0 comments
Open

Feature request: allow disabling the "clicking outside" mouse handler #1632

qbtf opened this issue Jan 4, 2025 · 0 comments

Comments

@qbtf
Copy link

qbtf commented Jan 4, 2025

First of all, thanks for the impressive component library! The headless architecture of Downshift make it easy and comfortable to make a combobox out from existing UI library with deep customization. I and our team made a reusable combobox component with Chakra UI v3 and Downshift as PoC, and the prototype1 is very concise.

However, there is a little problem that is hard to workaround: Chakra UI has an onInteractOutside mechanism (see its popover component) to manage popovers by maintaining a stack of layers. Downshift's useMouseAndTouchTracker handler, however, dispatches additional blur events alongside Chakra UI. We tried to block it in the reducer, but it is impossible to distinguish if a blur event is from the blur callback or from a regular InputBlur state change.

I can think of two approaches. One is to add an additional property to the blur callback, so that we can ignore the action coming from the blur callback. The other is to add an option to mask the blur callback completely. Either way makes Downshift's combobox more composable with UI libraries that implement that kind of mechanism themselves.

Footnotes

  1. My prototype: https://stackblitz.com/edit/chakra-downshift?file=src%2FApp.tsx.

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

No branches or pull requests

1 participant