Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

fix(modal): include select shadow root children in focus wrap queries #689

Conversation

emyarod
Copy link
Member

@emyarod emyarod commented Aug 23, 2021

Related Ticket(s)

#558

Description

This PR updates the currentContains queries to include all shadow root children (except for the endSentinel in order to preserve expected focus wrap behavior. unsure if the startSentinel needs to be an exception as well)

observe that clicking on the space in the modal body between the copy and the footer buttons no longer causes focus to be automatically placed on the modal close button any longer, and keyboard focus wrap behavior remains unchanged

original behavior (focus is returned to close button after clicking on the empty space):

Screen.Recording.2021-08-23.at.12.28.26.mov

updated behavior (focus is not moved to the close button after clicking on the empty space):

Screen.Recording.2021-08-23.at.12.29.04.mov

Changelog

Changed

  • modal currentContains logic in handleBlur method

* shadow root children do not appear in `this.contains(relatedTarget)` query
* `endSentinel` needs to be separate from other shadow root children in new `this.shadowRoot.contains(relatedTarget)` query
@emyarod emyarod requested review from asudoh and removed request for asudoh August 23, 2021 17:33
@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Aug 23, 2021

@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Aug 23, 2021

@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Aug 23, 2021

@ibmdotcom-bot
Copy link
Contributor

ibmdotcom-bot commented Aug 23, 2021

Copy link
Member

@jeffchew jeffchew left a comment

Choose a reason for hiding this comment

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

LGTM!

@jeffchew jeffchew added the Ready to merge Label for the pull requests that are ready to merge label Aug 23, 2021
@kodiakhq kodiakhq bot merged commit a4c6ba8 into carbon-design-system:master Aug 23, 2021
@emyarod emyarod deleted the 558-fix/modal-focus-wrap-shadow-root-relatedTarget branch August 23, 2021 20:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Ready to merge Label for the pull requests that are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants