-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Library
React Components / v9 (@fluentui/react-components)
System Info
N/AAre you reporting Accessibility issue?
no
Reproduction
N/A
Bug Description
For context #27759 & #27762 (comment).
We have currently FluentProvider & targetDocument that are our SSOT to bind event handlers in multiple areas:
fluentui/packages/react-components/react-tooltip/src/components/Tooltip/useTooltip.tsx
Lines 134 to 138 in d17c31e
| targetDocument?.addEventListener('keydown', onDocumentKeyDown, { | |
| // As this event is added at targeted document, | |
| // we need to capture the event to be sure keydown handling from tooltip happens first | |
| capture: true, | |
| }); |
fluentui/packages/react-components/react-utilities/src/hooks/useOnClickOutside.ts
Lines 76 to 78 in d17c31e
| element?.addEventListener('click', conditionalHandler, true); | |
| element?.addEventListener('touchstart', conditionalHandler, true); | |
| element?.addEventListener('contextmenu', conditionalHandler, true); |
fluentui/packages/react-components/react-tree/src/components/TreeItem/useTreeItem.tsx
Lines 172 to 175 in d17c31e
| targetDocument?.addEventListener('focusout', handleFocusOut, { passive: true }); | |
| return () => { | |
| targetDocument?.removeEventListener('focusout', handleFocusOut); | |
| }; |
Based on what will be passed to targetDocument (and what decision will be there) we need to decide how to handle these cases.
Logs
N/ARequested priority
High
Products/sites affected
No response
Are you willing to submit a PR to fix?
no
Validations
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.