Skip to content

refactor(cdk/platform): add common utility for resolving focused element #22708

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

Merged

Conversation

crisbeto
Copy link
Member

Based on a discussion on an earlier PR, these changes move the logic for resolving the activeElement while piercing through the shadow DOM into a common helper. Furthermore, they expand the logic to pierce through multiple layers of shadow DOM.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels May 17, 2021
@crisbeto crisbeto requested review from jelbourn and devversion May 17, 2021 04:59
@crisbeto crisbeto requested a review from mmalerba as a code owner May 17, 2021 04:59
@google-cla google-cla bot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 17, 2021
@crisbeto crisbeto force-pushed the shadow-dom-active-element-common branch 2 times, most recently from c78a58a to 3ca6bde Compare May 17, 2021 05:41
Based on a discussion on an earlier PR, these changes move the logic for resolving the `activeElement` while piercing through the shadow DOM into a common helper. Furthermore, they expand the logic to pierce through multiple layers of shadow DOM.
@crisbeto crisbeto force-pushed the shadow-dom-active-element-common branch from 3ca6bde to 0e09c1b Compare May 17, 2021 05:51
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me 👍

Should we add a test with multiple layers of shadow dom somewhere? e.g. in the focus trap?

@crisbeto
Copy link
Member Author

Not sure, my concern is that we use this in several places already so would we have to copy the same tests everywhere?

@crisbeto crisbeto added the action: merge The PR is ready for merge by the caretaker label May 17, 2021
@devversion
Copy link
Member

yeah, that's true. Though we are missing at least one test ensuring multiple layers of shadow dom are handled properly. I don't feel strongly though because we can assume the nested shadow DOM layers to behave similar to the top-level one (which we test in various places as you said).

@crisbeto
Copy link
Member Author

I think that we need more test coverage for cdk/platform in general since there is none at the moment.

@wagnermaciel wagnermaciel merged commit 25665dc into angular:master May 21, 2021
wagnermaciel pushed a commit that referenced this pull request May 21, 2021
…ent (#22708)

Based on a discussion on an earlier PR, these changes move the logic for resolving the `activeElement` while piercing through the shadow DOM into a common helper. Furthermore, they expand the logic to pierce through multiple layers of shadow DOM.

(cherry picked from commit 25665dc)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants