-
Notifications
You must be signed in to change notification settings - Fork 206
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
Manage tab order and focus placement with Overlay #728
Conversation
76fe2c1
to
2e8ea74
Compare
6a83090
to
db62b88
Compare
36e68ca
to
1c494cd
Compare
45e03cb
to
0f3599b
Compare
private overlayHolder!: HTMLElement; | ||
|
||
private initTabTrapping(): void { | ||
this.document.body.attachShadow({ mode: 'open' }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about the body shadowRoot collision issue that we discussed offline.
What are your thoughts on cancelling the tabTrapping initiation if a shadowRoot already exists in the body?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a bad idea for safety... document that users with other tools leveraging a shadowRoot
on the <body>
element just don't get the trapping functionality. Certainly better than just going and breaking apps that have this for some reason.
@@ -142,7 +230,7 @@ export class OverlayStack { | |||
|
|||
private async hideAndCloseOverlay( | |||
overlay?: ActiveOverlay, | |||
animated = true | |||
animated?: boolean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a distinction between animated: false
and animated: undefined
for overlays?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, yes. The overlay.hide(animated);
that receives this argument also does animated = true
in its method signature, which means that undefined
in this method actually means true
as it did before when given a default, only this way we can get test coverage on both lines...
0e78aa7
to
e1bf93c
Compare
e1bf93c
to
ed32c9b
Compare
ed32c9b
to
b69c0c5
Compare
b69c0c5
to
4ffef31
Compare
private initTabTrapping(): void { | ||
/* istanbul ignore if */ | ||
if (this.document.body.shadowRoot) { | ||
this.canTabTrap = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm 🥇
c2adf10
to
1593130
Compare
1593130
to
d20458b
Compare
Description
receivedFocus
sp-dropdown
and extensionrequestAnimationFrame
callsenter
presssp-radio-group
to appropriately manage keyboard interactionsDemo available at: https://westbrook-overlay-focus--spectrum-web-components.netlify.app/storybook/index.html?path=/story/action-menu--icon-only
Related Issue
fixes #709
fixes #710
fixes #723
fixes #727
Motivation and Context
How Has This Been Tested?
Types of changes
Checklist: