-
-
Notifications
You must be signed in to change notification settings - Fork 481
fix: mouseDown on the hidden element should not trigger close #1178
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,8 @@ export default function useSelectTriggerControl( | |
|
|
||
| if ( | ||
| open && | ||
| // Marked by SelectInput mouseDown event | ||
| !(event as any)._ignore_global_close && | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Accessing a custom property |
||
| elements() | ||
| .filter((element) => element) | ||
| .every((element) => !element.contains(target) && element !== target) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Directly modifying the native event object and casting it to
anycan lead to type safety issues and potential conflicts with other libraries that might also manipulate event objects. While this approach fixes the immediate bug, it relies on undocumented behavior and can be fragile. Consider using a more idiomatic React pattern, such as a context provider or a ref, to pass this_ignore_global_closeflag to theuseSelectTriggerControlhook.