-
Notifications
You must be signed in to change notification settings - Fork 860
[EuiCodeBlock] Add accessible labels for virtualized code blocks #8887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EuiCodeBlock] Add accessible labels for virtualized code blocks #8887
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes look alright 👍🏻
Testing notes
{
"aria-label": "Some label",
"isVirtualized": true,
"overflowHeight": 100,
"whiteSpace": "pre"
}❓ Notice how aria-label is not read. Shouldn't we concatenate aria-label and '{language} code block:'?
🔊 VO + Safari (MacOS)
Screen.Recording.2025-07-23.at.17.08.55.mov
✅ "text code block" is read
🔊 NVDA + Firefox (Windows)
Screen.Recording.2025-07-23.at.16.29.40.mov
✅ "text code block" is read
🔊 JAWS + Chrome (Windows)
Screen.Recording.2025-07-23.at.17.24.57.mov
✅ "text code block" is read
@weronikaolejniczak Yeah, that's because Updated in 974b992
|
💚 Build SucceededHistory
cc @mgadewoll |
💚 Build Succeeded
History
cc @mgadewoll |
weronikaolejniczak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! 🟢 Thanks for following through on this issue, Lene 💪🏻
`106.1.0` ⏩ `106.2.0` [Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams) ## Package updates ### `@elastic/eui` #### [`v106.2.0`](https://github.com/elastic/eui/releases/v106.2.0) - Enhanced `EuiCheckableCard` to make non-interactive children clickable for card selection ([#8907](elastic/eui#8907)) - Added `showFooter` and `toolbarProps.right` props to `EuiMarkdownEditor` for more flexible layout control. ([#8889](elastic/eui#8889)) ([#8889](elastic/eui#8889)) **Bug fixes** - Fixed `EuiPopover` not closing on outside click after multiple fast clicks on the trigger element ([#8882](elastic/eui#8882)) **Accessibility** - Added accessible labels to virtualized `EuiCodeBlock` ([#8887](elastic/eui#8887)) --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Marta Bondyra <[email protected]>
`106.1.0` ⏩ `106.2.0` [Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams) ## Package updates ### `@elastic/eui` #### [`v106.2.0`](https://github.com/elastic/eui/releases/v106.2.0) - Enhanced `EuiCheckableCard` to make non-interactive children clickable for card selection ([elastic#8907](elastic/eui#8907)) - Added `showFooter` and `toolbarProps.right` props to `EuiMarkdownEditor` for more flexible layout control. ([elastic#8889](elastic/eui#8889)) ([elastic#8889](elastic/eui#8889)) **Bug fixes** - Fixed `EuiPopover` not closing on outside click after multiple fast clicks on the trigger element ([elastic#8882](elastic/eui#8882)) **Accessibility** - Added accessible labels to virtualized `EuiCodeBlock` ([elastic#8887](elastic/eui#8887)) --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Marta Bondyra <[email protected]>
`106.1.0` ⏩ `106.2.0` [Questions? Please see our Kibana upgrade FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams) ## Package updates ### `@elastic/eui` #### [`v106.2.0`](https://github.com/elastic/eui/releases/v106.2.0) - Enhanced `EuiCheckableCard` to make non-interactive children clickable for card selection ([elastic#8907](elastic/eui#8907)) - Added `showFooter` and `toolbarProps.right` props to `EuiMarkdownEditor` for more flexible layout control. ([elastic#8889](elastic/eui#8889)) ([elastic#8889](elastic/eui#8889)) **Bug fixes** - Fixed `EuiPopover` not closing on outside click after multiple fast clicks on the trigger element ([elastic#8882](elastic/eui#8882)) **Accessibility** - Added accessible labels to virtualized `EuiCodeBlock` ([elastic#8887](elastic/eui#8887)) --------- Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Marta Bondyra <[email protected]>
- Move accessibility labels outside virtualized container - Prevents react-window scroll calculation issues - Preserves accessibility features from PR elastic#8887 - Fixes blank line rendering when content updates while scrolled Closes elastic#9034
- Fixes blank rendering in virtualized CodeBlock when scrolled (elastic#9034) - Moves labels outside <pre> in both virtualized and regular variants - Preserves accessibility while preventing react-window calculation issues - Ensures consistent architecture across all CodeBlock rendering modes Partially reverts the implementation approach from PR elastic#8887 while maintaining the accessibility improvements.
- Fixes blank rendering in virtualized CodeBlock when scrolled (elastic#9034) - Moves labels outside <pre> in both virtualized and regular variants - Preserves accessibility while preventing react-window calculation issues - Ensures consistent architecture across all CodeBlock rendering modes Partially reverts the implementation approach from PR elastic#8887 while maintaining the accessibility improvements.
- Fixes blank rendering in virtualized CodeBlock when scrolled (elastic#9034) - Moves labels outside <pre> in both virtualized and regular variants - Preserves accessibility while preventing react-window calculation issues - Ensures consistent architecture across all CodeBlock rendering modes Partially reverts the implementation approach from PR elastic#8887 while maintaining the accessibility improvements.


Summary
relates to elastic/kibana#205331 (comment)
This PR adds missing accessible labels for
EuiCodeBlockwhenisVirtualized. We previously added accessible labels in #8195 but they were not applied to the virtualized output.Why are we making this change?
Fixing an Accessibility issue for missing role and name information on
EuiCodeBlock.🔗 WCAG 4.1.2: Name, Role, Value (Level A)
Screenshots
Screen.Recording.2025-07-21.at.18.02.28.mov
Screen.Recording.2025-07-21.at.18.03.34.mov
Impact to users
🟢 There are no updates required on consumer side.
QA
isVirtualizedandoverflowHeight: {number}(e.g.100)Example output:
text code block: <p> <!-- Hello world --> </p> groupGeneral checklist
Checked in both light and dark modesChecked in both MacOS and Windows high contrast modesChecked in mobileChecked for accessibility including keyboard-only and screenreader modesAdded documentationProps have proper autodocs (using@defaultif default values are missing) and playground togglesChecked Code Sandbox works for any docs examplesAdded or updated jest and cypress testsUpdated visual regression testsIf applicable, added the breaking change issue label (and filled out the breaking change checklist)If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)