behaviors icon indicating copy to clipboard operation
behaviors copied to clipboard

Prevent focusing hidden/disabled elements

Open TylerJDev opened this issue 1 year ago • 3 comments

Closes https://github.com/primer/behaviors/issues/257

This PR attempts to address the issue where if an element is disabled or hidden after the focusZone function has ran, the focus trap no longer works. I've adjusted the mutation observer that watches for added or removed nodes within the focusZone container to now track the hidden and disabled attributes.

If either attribute is applied or removed, they will added/removed from the focus trap respectively.

TylerJDev avatar Dec 19 '23 21:12 TylerJDev

🦋 Changeset detected

Latest commit: a54cafcfa9c3ab26578f6b4347c4028b7066cfd5

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

changeset-bot[bot] avatar Dec 19 '23 21:12 changeset-bot[bot]

Hi! This pull request has been marked as stale because it has been open with no activity for 60 days. You can comment on the pull request or remove the stale label to keep it open. If you do nothing, this pull request will be closed in 7 days.

github-actions[bot] avatar Mar 03 '24 16:03 github-actions[bot]

Hi! This pull request has been marked as stale because it has been open with no activity for 60 days. You can comment on the pull request or remove the stale label to keep it open. If you do nothing, this pull request will be closed in 7 days.

github-actions[bot] avatar May 05 '24 20:05 github-actions[bot]

Hey team! I was wondering if I could get a review on this PR? For context it's making sure that disabled or hidden elements are removed from the focus zone if they are disabled/hidden after it has been initiated. It'll also add the elements back if they are no longer disabled/hidden. This is primarily useful when using focus-zone outside of React.

@primer/engineer-reviewers

TylerJDev avatar May 08 '24 14:05 TylerJDev