Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 22, 2022. It is now read-only.

Trap focus when connected in <details open> #90

Merged
merged 2 commits into from
Aug 15, 2022

Conversation

seanpdoyle
Copy link
Contributor

When the <details-dialog> element is connected to the document as a
child of a <details> element rendered with [open], trap focus
immediately.

In support of this change, extract the trapFocus and releaseFocus
functions, then call trapFocus within the connectedCallback if the
ancestor detail is [open].

@seanpdoyle seanpdoyle requested a review from a team as a code owner August 9, 2022 19:31
@seanpdoyle seanpdoyle requested a review from manuelpuyol August 9, 2022 19:31
When the `<details-dialog>` element is connected to the document as a
child of a `<details>` element rendered with `[open]`, trap focus
immediately.

In support of this change, extract the `trapFocus` and `releaseFocus`
functions, then call `trapFocus` within the `connectedCallback` if the
ancestor detail is `[open]`.
@seanpdoyle seanpdoyle force-pushed the trap-focus-when-connected-as-open branch from db1fbd1 to 56499c5 Compare August 9, 2022 19:47
Copy link
Contributor

@manuelpuyol manuelpuyol left a comment

Choose a reason for hiding this comment

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

this lgtm!
any opinions @koddsson @keithamus ?

@manuelpuyol
Copy link
Contributor

hey @seanpdoyle just a heads up, code wise this looks good, but I want to check with our accessibility team if the change is good for them too :)

Copy link

@lindseywild lindseywild left a comment

Choose a reason for hiding this comment

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

Looks good from accessibility ✨ Thank you!

@manuelpuyol manuelpuyol enabled auto-merge August 15, 2022 14:29
@manuelpuyol manuelpuyol merged commit e1aece5 into github:main Aug 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants