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

Fix multiple issues surrounding trap deactivation #659

Merged
merged 1 commit into from
Apr 28, 2022
Merged

Conversation

stefcameron
Copy link
Member

  • Consistently call onDeactivate, onPostDeactivate, checkCanReturnFocus

These options were not being called consistently, particularly because
of the way focus-trap-react tries to participate in the trap's
deactivation process in order to control how focus is returned
(if the trap is configured to return focus after deactivation).

  • Ensure an outside click permitted to deactivate the trap with the
    clickOutsideDeactivates=true option is actually permitted to so
    and focus remains on the outside node clicked rather than returning
    to the node that had focus prior to the trap being activated (which
    is the default behavior).

  • Required bump to focus-trap v6.9.0 for bug fixes and new features
    to help with above fixes.

PR Checklist

Please leave this checklist in your PR.

  • Issue being fixed is referenced.
  • Source changes maintain:
    • Stated browser compatibility.
    • Stated React compatibility.
  • Unit test coverage added/updated.
  • E2E test coverage added/updated.
  • Prop-types added/updated.
  • Typings added/updated.
  • Changes do not break SSR:
    • Careful to test typeof document/window !== 'undefined' before using it in code that gets executed on load.
  • README updated (API changes, instructions, etc.).
  • Changes to dependencies explained.
  • Changeset added (run yarn changeset locally to add one, and follow the prompts).
    • EXCEPTION: A Changeset is not required if the change does not affect any of the source files that produce the package bundle. For example, demo changes, tooling changes, test updates, or a new dev-only dependency to run tests more efficiently should not have a Changeset since it will not affect package consumers.

- Consistently call onDeactivate, onPostDeactivate, checkCanReturnFocus

These options were not being called consistently, particularly because
of the way focus-trap-react tries to participate in the trap's
deactivation process in order to control how focus is returned
(if the trap is configured to return focus after deactivation).

- Ensure an outside click permitted to deactivate the trap with the
  `clickOutsideDeactivates=true` option is actually permitted to so
  _and_ focus remains on the outside node clicked rather than returning
  to the node that had focus prior to the trap being activated (which
  is the default behavior).

- Required bump to focus-trap v6.9.0 for bug fixes and new features
  to help with above fixes.
@changeset-bot
Copy link

changeset-bot bot commented Apr 28, 2022

🦋 Changeset detected

Latest commit: 05e795a

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

This PR includes changesets to release 1 package
Name Type
focus-trap-react 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

@codecov
Copy link

codecov bot commented Apr 28, 2022

Codecov Report

Merging #659 (f766fdf) into master (aed24d5) will decrease coverage by 1.86%.
The diff coverage is 90.90%.

❗ Current head f766fdf differs from pull request most recent head 05e795a. Consider uploading reports for the commit 05e795a to get more accurate results

@@            Coverage Diff             @@
##           master     #659      +/-   ##
==========================================
- Coverage   95.20%   93.33%   -1.87%     
==========================================
  Files           1        1              
  Lines         125      150      +25     
  Branches       50       63      +13     
==========================================
+ Hits          119      140      +21     
- Misses          6       10       +4     
Impacted Files Coverage Δ
src/focus-trap-react.js 93.33% <90.90%> (-1.87%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aed24d5...05e795a. Read the comment docs.

@stefcameron stefcameron merged commit 7495680 into master Apr 28, 2022
@stefcameron stefcameron deleted the bug-fixes branch April 28, 2022 20:49
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.

1 participant