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.

[Modal] Request to add option to disable focus trap

See original GitHub issue

Is your feature request related to a problem? Please describe. I am attempting to open a drawer on the right while maintaining an interactable menu down the left. I can position the left menu so that links can be clicked by manually selecting the html elements of the drawer and manipulating their width, but this still leaves my left menu search bar as unfocusable. This “solution” is less than ideal as I don’t want to cripple my UX to support this particular drawer, and it’s pretty messy selecting and modifying elements manually.

Describe the solution you’d like Two things would be extremely useful, both providing the drawer with more flexibility.

  1. Add an option to disable the focus trap disableFocusTrap?: boolean.

  2. Add an option to control the height/width of the area occupied by the modal/overlay/etc. This would allow for situations where parts of the UI could still be interacted with without closing the drawer.

Describe alternatives you’ve considered There is no real way around the focus trap as it currently stands. When the drawer is open, nothing can be done to escape it (that I’m aware of). The interactable area problem can be partially solved by manually manipulating the elements once they’re rendered, but this is pretty ugly and definitely shouldn’t be encouraged.

Additional context This is a simplified example, but it contains the basics. The righthand drawer is opened when someone is selected from the panel on the left. I need the panel on the left to still be interactable so that another user can be selected without first closing the drawer Screen Shot 2020-03-31 at 9 00 48 AM

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
segunadebayocommented, Apr 6, 2020

This has been resolved in preparation for the next release.

Thanks for bringing it up.

5reactions
aquibbaigcommented, Jun 19, 2021

@segunadebayo Sorry but I am looking for this feature, has this been implemented yet?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Trap Focus Inside a Modal - Medium
We are going to talk about How to Trap Focus inside of a modal as long as it is open and transfer focus...
Read more >
How to keep focus within modal dialog? - Stack Overflow
One solution that is popular is to create a query selector of all known focusable elements and then trap focus to the modal...
Read more >
Trap focus in a React component - Robin van der Vleuten
With a script attached to the HTML page, we can trap the focus when the modal is shown. import { createFocusTrap } from...
Read more >
focus-trap demo - GitHub Pages
This focus trap leverages the escapeDeactivates option as a function rather than a boolean. By default, pressing ESC will deactivate the trap, but...
Read more >
React Focus Trap component - MUI Base
Focus Trap is a utility component that's useful when implementing an overlay such as a modal dialog, which should block all interactions outside...
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