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

fix(material/autocomplete): incorrectly resolving focused element in shadow DOM #30619

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

crisbeto
Copy link
Member

There are a few places where the autocomplete was checking if it has focus which were breaking down when inside the shadow DOM, because document.activeElement will point to the closest shadow root.

These changes consolidate the places where we check for focus and use our utility for resolving the focused element through shadow boundaries.

Fixes #30611.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
…shadow DOM

There are a few places where the autocomplete was checking if it has focus which were breaking down when inside the shadow DOM, because `document.activeElement` will point to the closest shadow root.

These changes consolidate the places where we check for focus and use our utility for resolving the focused element through shadow boundaries.

Fixes angular#30611.
@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Mar 12, 2025
@crisbeto crisbeto requested a review from a team as a code owner March 12, 2025 08:10
@crisbeto crisbeto requested review from mmalerba and andrewseguin and removed request for a team March 12, 2025 08:10
@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label Mar 12, 2025
@crisbeto crisbeto merged commit e61d152 into angular:main Mar 12, 2025
23 of 25 checks passed
@crisbeto
Copy link
Member Author

The changes were merged into the following branches: main, 19.2.x

crisbeto added a commit that referenced this pull request Mar 12, 2025
…shadow DOM (#30619)

There are a few places where the autocomplete was checking if it has focus which were breaking down when inside the shadow DOM, because `document.activeElement` will point to the closest shadow root.

These changes consolidate the places where we check for focus and use our utility for resolving the focused element through shadow boundaries.

Fixes #30611.

(cherry picked from commit e61d152)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action: merge The PR is ready for merge by the caretaker area: material/autocomplete target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(matAutocomplete): Autocomplete not opening with shadow DOM
2 participants