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

[#705] Fix setReturnFocus option as function not getting prev node #706

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

stefcameron
Copy link
Member

Fixes #705

When the setReturnFocus option is a function, it should get the
previously focused node prior to activation as its first parameter,
yet it was not because of the special handling in focus-trap-react
for trap deactivation.

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.

Fixes #705

When the `setReturnFocus` option is a function, it should get the
previously focused node prior to activation as its first parameter,
yet it was not because of the special handling in focus-trap-react
for trap deactivation.
@changeset-bot
Copy link

changeset-bot bot commented Jun 9, 2022

🦋 Changeset detected

Latest commit: ebea041

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 Patch

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 Jun 9, 2022

Codecov Report

Merging #706 (ebf2a32) into master (42ce4ab) will decrease coverage by 0.57%.
The diff coverage is 82.35%.

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

@@            Coverage Diff             @@
##           master     #706      +/-   ##
==========================================
- Coverage   93.33%   92.76%   -0.58%     
==========================================
  Files           1        1              
  Lines         150      152       +2     
  Branches       63       65       +2     
==========================================
+ Hits          140      141       +1     
- Misses         10       11       +1     
Impacted Files Coverage Δ
src/focus-trap-react.js 92.76% <82.35%> (-0.58%) ⬇️

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 42ce4ab...ebea041. Read the comment docs.

@stefcameron stefcameron merged commit 519e5a5 into master Jun 9, 2022
@stefcameron stefcameron deleted the set-return-focus branch June 9, 2022 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant