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

[FocusZone] Clear all active descendants #462

Merged
merged 4 commits into from
Oct 21, 2024
Merged

Conversation

camertron
Copy link
Contributor

@camertron camertron commented Oct 17, 2024

This PR makes several changes to focus-zone:

  1. Passes the abort controller's signal to several event listeners where it is currently missing.
  2. Changes clearActiveDescendant to loop over all child elements with the data-is-active-descendant attribute and removes it from each. The current behavior only removes the attribute from a single element, which is a problem in React apps because React re-uses elements with the same key, resulting in more than one element being marked as the active descendant.

Copy link

changeset-bot bot commented Oct 17, 2024

🦋 Changeset detected

Latest commit: ee1e19d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/behaviors Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@camertron camertron marked this pull request as ready for review October 18, 2024 18:08
@camertron camertron requested a review from a team as a code owner October 18, 2024 18:08
@camertron camertron requested review from joshblack and dgreif and removed request for joshblack October 18, 2024 18:08
@camertron camertron changed the title WIP [FocusZone] Clear all active descendants Oct 18, 2024
Copy link
Member

@dgreif dgreif left a comment

Choose a reason for hiding this comment

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

Glad you were able to find a fix!

src/focus-zone.ts Show resolved Hide resolved
@camertron camertron merged commit 394b0fe into main Oct 21, 2024
9 checks passed
@camertron camertron deleted the clear_all_descendants branch October 21, 2024 18:12
@primer-css primer-css mentioned this pull request Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants