Modal, Vanilla: AVT 2 issue: Keyboard users can't scroll static content when it overflows
See original GitHub issueEnvironment
Operating system
Mac
Browser
All
Automated testing tool and ruleset
n/a
Assistive technology used to verify
Keyboard
Detailed description
What version of the Carbon Design System are you using?
v10.3.2
What did you expect to happen?
I would be able to focus the content container so that I could use my arrow keys to scroll the content
What happened instead?
I was not able to focus the container that had overflowing content so I was not able to read it
What WCAG 2.1 checkpoint does the issue violate?
https://www.ibm.com/able/guidelines/ci162/keyboard.html
Steps to reproduce the issue
Using only a keyboard
- navigate within a modal that has overflowing content
- notice you can never focus the content, making it so you can’t scroll it unless you are using a mouse
Please create a reduced test case in CodeSandbox
Includes the HTML fix: https://codesandbox.io/embed/modal-overflow-content-srskh
Additional information
- Need to add
tabindex=0
to the content container so that it is focusable. This should be done only when the content overflows for the best experiences (dynamically via JS). - Need input from @carbon-design-system/design around what the focus style for the content container should be
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Fixed modal wont scroll when overflowing the viewport
The modal has content whose height may end up larger than the viewport and thus needs to scroll, but its just not working....
Read more >Well-controlled scrolling with CSS Scroll Snap - web.dev
Here scroll snapping ensures at the end of scrolling an image horizontal center is aligned with the horizontal center of the scroll container....
Read more >Modal | Bulma
A classic modal overlay, in which you can include any content you want ... modifier to a containing element (usually html ) to...
Read more >Dialog Focus in Screen Readers - Adrian Roselli
The content area has tabindex="0" because the content can scroll and this allows a keyboard-only user to scroll it. My test suite on...
Read more >Prevent Page Scrolling When a Modal is Open | CSS-Tricks
Unfortunately overscroll-behavior: contain does not prevent the scrolling when the content is less or equal to the parent(as in, no overflow).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dakahn this is the styling (which were just merged in to master) that was approved for design: https://github.com/carbon-design-system/carbon/issues/3261#issuecomment-507864039 and having it always on just means that if you are tabbing within a modal, you will always be able to highlight the content even if it’s not scrollable.
@carbon-design-system/developers if you want to assign this to me I can take a look at it in the next couple of weeks