Skip to content

Conversation

@mgadewoll
Copy link
Contributor

@mgadewoll mgadewoll commented Jul 21, 2025

Summary

relates to elastic/kibana#205331 (comment)

This PR adds missing accessible labels for EuiCodeBlock when isVirtualized. 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

before after
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

  • open Storybook and set isVirtualized and overflowHeight: {number} (e.g. 100)
    • verify that the code block label is read when navigating onto EuiCodeBlock in a screen reader (e.g. "text code block")
    • verify that the code block label is read when opening the fullscreen mode and navigating onto EuiCodeBlock in a screen reader (e.g. "text code block")

Example output: text code block: <p> <!-- Hello world --> </p> group

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in both MacOS and Windows high contrast modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer 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)

@mgadewoll mgadewoll self-assigned this Jul 21, 2025
@mgadewoll mgadewoll changed the title Codeblock/ensure accessible label for virtualized variant [EuiCodeBlock] Add accessible labels for virtualized code blocks Jul 21, 2025
@mgadewoll mgadewoll marked this pull request as ready for review July 21, 2025 16:37
@mgadewoll mgadewoll requested a review from a team as a code owner July 21, 2025 16:37
@weronikaolejniczak weronikaolejniczak self-requested a review July 22, 2025 13:55
Copy link
Contributor

@weronikaolejniczak weronikaolejniczak left a 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

@mgadewoll
Copy link
Contributor Author

Notice how aria-label is not read. Shouldn't we concatenate aria-label and '{language} code block:'?

@weronikaolejniczak Yeah, that's because aria-label is applied to the <code> element via ...rest and the support seems patchy (VO reads it, NVDA doesn't). 🤔 Considering we should ensure unique naming for multiple elements, it would be good to make the aria-label more useful, yes. Great suggestion 👍

Updated in 974b992

with aria-label without aria-label
Screenshot 2025-07-24 at 09 25 35 Screenshot 2025-07-24 at 09 25 49

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

Copy link
Contributor

@weronikaolejniczak weronikaolejniczak left a 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 💪🏻

@mgadewoll mgadewoll merged commit fe24ddf into elastic:main Jul 24, 2025
5 checks passed
tkajtoch added a commit to elastic/kibana that referenced this pull request Aug 5, 2025
`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]>
delanni pushed a commit to delanni/kibana that referenced this pull request Aug 5, 2025
`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]>
NicholasPeretti pushed a commit to NicholasPeretti/kibana that referenced this pull request Aug 18, 2025
`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]>
sravanth-space added a commit to sravanth-space/eui that referenced this pull request Nov 9, 2025
- 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
sravanth-space added a commit to sravanth-space/eui that referenced this pull request Nov 9, 2025
- 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.
sravanth-space added a commit to sravanth-space/eui that referenced this pull request Nov 11, 2025
- 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.
sravanth-space added a commit to sravanth-space/eui that referenced this pull request Nov 14, 2025
- 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants