material-ui
material-ui copied to clipboard
[base] Removes invisible tabbable elements from `TrapFocus` component
- [x] I have followed (at least) the PR section of the contributing guide.
Problem description
Described in issue #33380
Solution
Setting tabIndex={open ? 0 : -1}
on sentinelStart
and sentinelEnd
elements so that they're only tabbable when the TrapFocus
open
prop is true
. Thus removing the awkward experience where there are invisible tabbable elements.
Generated by :no_entry_sign: dangerJS against bf6dd7d8a75c36394bef7c3ccde77a95a9d74644
cc @michaldudak would be great to have a second opinion on the changes. @samuelsycamore for reviewing the copywriting.
I haven't thought of such a use case before, but these changes look OK to me.
As a follow-up, I think we'd have to rename the open
prop. enabled
would make more sense, especially for such cases.
When I tried to resync the master
branch of my fork the PR autoclosed! Reopening!
@michaldudak I really like the idea of the prop being enabled
, but I also know that change could be wide reaching. You're not recommending that change for this PR, are you?
No, not at all, this should be a separate PR that we can handle on our own.
Same deal as before. Next time I won't open a PR off a fork from master
. I'd change to another branch now but it seems like I'd have to open a new PR.
Requesting a re-review from @samuelsycamore & @mnajdova ! 😄
Is that how I should do that? I legitimately don't know.