question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Return focus on outside click does not respect "returnFocusOnDeactivate" value

See original GitHub issue

After this issue: https://github.com/davidtheclark/focus-trap/issues/60, the click handler returns the focus to the focus trap if the new target is not clickable. However, this happens even if the returnFocusOnDeactivate configuration option is passed in as false: https://github.com/davidtheclark/focus-trap/blob/master/index.js#L111-L114

Because I have set returnFocusOnDeactivate to false, I was expecting that the focus trap would not return the focus. I feel like it should respect that configuration value and only return the focus when it is set to true and the new target is not clickable.

It was confusing for me so I am just wondering if this is intentional or if it is a bug. If it is intentional, I’m curious as to why, and if it is just a bug, I would be happy to open a PR to fix it.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
stefcameroncommented, Oct 3, 2020

This is fixed in version 6.1.1 🎉

@all-contributors add @Slapbox for bug

2reactions
stefcameroncommented, Sep 22, 2020

@Slapbox 😆 It happens, I know! I’m still thankful that you ended-up on this issue because your inquiry led us to uncovering a bug that needs to be fixed, which will increase the quality and user satisfaction for this package.

It sounds like you’ve been able to sort things out, though, over on focus-trap-react, so I’m glad things are working for you now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React, how do not loose focus on element when click outside ...
I have a component, where I focus on component I need not to loose focus when I focus my cursor on browsers address...
Read more >
Top 5 focus-trap-react Code Examples - Snyk
If true, a click outside the focus trap will deactivate the focus trap and allow ... If false, when the trap is deactivated,...
Read more >
focus-trap-react | Yarn - Package Manager
A React component that traps focus. This component is a light wrapper around focus-trap, tailored to your React-specific needs. You might want it...
Read more >
Source - GitHub
There are no longer any versions of IE that are still maintained or even ... will be brought back in focus if focus...
Read more >
focus-trap demo - GitHub Pages
When you tab through the trap, focus does not return to the containing element. Also, clicking on an outside element automatically deactivates this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found