Skip to content

[EuiMarkdownEditor][A11y] Fix invalid nested interactive elements#9625

Merged
mgadewoll merged 7 commits intoelastic:mainfrom
mgadewoll:markdowneditor/a11y-fix-nested-interactive-elements
May 5, 2026
Merged

[EuiMarkdownEditor][A11y] Fix invalid nested interactive elements#9625
mgadewoll merged 7 commits intoelastic:mainfrom
mgadewoll:markdowneditor/a11y-fix-nested-interactive-elements

Conversation

@mgadewoll
Copy link
Copy Markdown
Contributor

@mgadewoll mgadewoll commented Apr 30, 2026

Summary

Caused by: elastic/kibana#263605

The EUI markdown editor's drop zone div gets role="button" from react-dropzone by default, even when no drop handlers are configured. This wraps the textarea in a semantic button, triggering an axe-core "Interactive controls must not be nested" violation (WCAG 4.1.2 Level A).

This PR updates EuiMarkdownEditor by removing the added role="button" on the drop zone wrapper element.
This would result in invalid nested interactive elements as the button would nest the textarea.

The change removes the role completely, considering that the drop zone doesn't actually support keyboard interaction as is (it's also disabled via noKeyboard in the drop zone settings). The drop zone basically only works for mouse interaction while we're already making use of a standalone way via a button in the footer to add files instead.

API Changes

⚪ No API changes

Screenshots

Before After
Screen.Recording.2026-04-30.at.14.06.10.mov
Screen.Recording.2026-04-30.at.14.06.42.mov

Impact Assessment

Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.

  • 🔴 Breaking changes — What will break? How many usages in Kibana/Cloud UI are impacted?
  • 💅 Visual changes — May impact style overrides; could require visual testing. Explain and estimate impact.
  • 🧪 Test impact — May break functional or snapshot tests (e.g., HTML structure, class names, default values).
  • 🔧 Hard to integrate — If changes require substantial updates to Kibana, please stage the changes and link them here.

Impact level: 🟢 Low
The removes role might require snapshot updates.

Release Readiness

  • Documentation: {link to docs page(s)}
  • Figma: {link to Figma or issue}
  • Migration guide: {steps or link, for breaking/visual changes or deprecations}
  • Adoption plan (new features): {link to issue/doc or outline who will integrate this and where}

QA instructions for reviewer

💻 EuiMarkdownEditor storybook

  • verify there is no regression with production
  • verify adding files is possible via a) dragging files with the mouse OR b) adding them via keyboard using the dedicated upload button

Checklist before marking Ready for Review

Reviewer checklist

  • Approved Impact Assessment — Acceptable to merge given the consumer impact.
  • Approved Release Readiness — Docs, Figma, and migration info are sufficient to ship.

@mgadewoll mgadewoll self-assigned this Apr 30, 2026
@mgadewoll
Copy link
Copy Markdown
Contributor Author

buildkite test this

@mgadewoll mgadewoll marked this pull request as ready for review May 4, 2026 08:48
@mgadewoll mgadewoll requested a review from a team as a code owner May 4, 2026 08:48
Copilot AI review requested due to automatic review settings May 4, 2026 08:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an accessibility issue in EuiMarkdownEditor by removing the drop zone wrapper’s misleading role="button", which was creating an invalid nested interactive-element structure around the textarea.

Changes:

  • Removes the default drop zone role in markdown_editor_drop_zone.tsx
  • Adds a Storybook drop-zone scenario for manual QA
  • Updates Jest snapshots and adds a changelog entry for the accessibility fix

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/eui/src/components/markdown_editor/markdown_editor.stories.tsx Adds a new DropZone story with a stateful wrapper for manual drag-and-drop testing.
packages/eui/src/components/markdown_editor/markdown_editor_drop_zone.tsx Removes the drop zone wrapper’s role="button" assignment.
packages/eui/src/components/markdown_editor/__snapshots__/markdown_editor.test.tsx.snap Updates rendered snapshots to reflect the removed role attribute.
packages/eui/changelogs/upcoming/9625.md Documents the accessibility fix in the upcoming changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/eui/src/components/markdown_editor/markdown_editor.stories.tsx Outdated
@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

@tkajtoch tkajtoch self-requested a review May 4, 2026 10:51
Copy link
Copy Markdown
Member

@tkajtoch tkajtoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mgadewoll mgadewoll merged commit 4770339 into elastic:main May 5, 2026
5 checks passed
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.

4 participants