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.

v5.3.0 breaks literally all of our usage of `tabbable` 😅 when called on a node not attached to the document

See original GitHub issue

The change to use getClientRects().length completely breaks this library for us: https://github.com/focus-trap/tabbable/pull/604

We use tabbable when initializing dialogs, to find candidate element(s) to auto-focus when the dialog appears. These dialogs are React components and the call to tabbable() occurs during the componentDidMount lifecycle method. At that moment, the DOM elements we want to traverse using tabbable are fully formed, but they are not yet attached to the document. So getClientRects().length always returns 0, and thus every single one of our calls to tabbable fails. (At this library level, we have no way to control when the dialog is actually attached to the document.)

Could this change be reverted, or can we scope it to only be used when document.body.contains(node)?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:39 (24 by maintainers)

github_iconTop GitHub Comments

3reactions
idoroscommented, May 6, 2022

I agree that the current behavior should be preserved as there are probably many that depends on it, but would change next major version to swap the default behavior to reflect the fact that detached nodes are not actually tabbable/focusable, with an option to ignore isHidden on detached nodes.

3reactions
stefcameroncommented, May 6, 2022

Love this discussion! 😆 Glad we can laugh a bit along the way, even with memes. Yes, what an adventure we are on in software land…

So I think we have solution, which is to assume that a detached node is visible. That should restore the old behavior, while letting us keep using the new optimization with getClientRects() when it’s attached.

I will update my PR tomorrow accordingly and will get a patch out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AiMesh in 2022: Asus's Ride to Solid Wi-Fi | Dong Knows Tech
Asus AiMesh is one of the best ways to improve your Wi-Fi. Learn all about it and get yours up and running via...
Read more >
Archived Comments - null program
Yeah, I like cranking up all the static code checks on all my (personal) projects, no matter the language. With Java, I use...
Read more >
Fastly Varnish ⋆ Mark McDonnell - integralist
In this post I'm going to be explaining how the Fastly CDN works, with regards to their 'programmatic edge' feature (i.e. the ability...
Read more >
Add CKEditor 5 module to Drupal core [#3231364]
The easy questions to answer: Why? Why switch from CKEditor 4? It's approaching its end-of-life in 2023. Why CKEditor 5 and not something ......
Read more >
The Instruction Limit – Tech talk and game programming by ...
PC + Mac versions of FEZ used a C# Ogg Vorbis decoder called NVorbis, ... The PC version ran on my fork of...
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