fix(ui-modal): skip Modal.Body tab stop when it has focusable children#2584
Conversation
|
Visual regression report✅ No changes.
Baselines come from the |
| 'type', | ||
| 'class', | ||
| 'style' | ||
| ] |
There was a problem hiding this comment.
based on the set of attributes that findTabbable reads
There was a problem hiding this comment.
Can you put this as a comment to findTabbble? This is important because we might replace findTabbable in the future, it has several flaws
| if (isFirefox) { | ||
| this.setState({ isFirefox }) | ||
| } | ||
|
|
There was a problem hiding this comment.
This was needed to handle the the case when the modal body content changes dinamically (a scrollbar or a focusable element appears or disappears)
matyasf
left a comment
There was a problem hiding this comment.
looks good, just a small comment. In the future we should look into replacing this with some native code (e.g. https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/dialog ) because there are constantly issues with this code
| 'type', | ||
| 'class', | ||
| 'style' | ||
| ] |
There was a problem hiding this comment.
Can you put this as a comment to findTabbble? This is important because we might replace findTabbable in the future, it has several flaws
INSTUI-5046
ISSUE:
TEST PLAN:
Copy the code below into the documentation.
Open the modal using only the keyboard.
Keep the modal open.
Keep the modal open.
Turn the "Focusable element in body" toggle back off.
Check that Modal.Body gets tabIndex={0} when it contains no focusable elements.
Check that Modal.Body does NOT get tabIndex={0} when it contains at least one focusable element.
should work in v1 and v2 too