Skip to content

[Bug]: event handlers should be bind properly for Shadow DOM [v9] #27763

@layershifter

Description

@layershifter

Library

React Components / v9 (@fluentui/react-components)

System Info

N/A

Are 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:

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,
});

element?.addEventListener('click', conditionalHandler, true);
element?.addEventListener('touchstart', conditionalHandler, true);
element?.addEventListener('contextmenu', conditionalHandler, true);

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/A

Requested 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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions