fix(a11y): focus monitor not identifying touch focus inside shadow root #17167
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
FocusMonitor
uses atouchstart
listener on thedocument
to identify when an element was focused via touch. The problem is that if an element is inside the shadow DOM, theevent.target
will be set to the shadow root. These changes usecomposedPath
to get the event target which accounts for the shadow DOM.Note: I was unable to write a test that captures the error, because our fake touch events weren't behaving similarly to the ones the browser dispatches from the shadow DOM.