Skip to content

fix(a11y): DOTCOM-180525 - error toast Close button not keyboard accessible#111

Open
dstrong23 wants to merge 1 commit into
stagefrom
fix-DOTCOM-180525-v2
Open

fix(a11y): DOTCOM-180525 - error toast Close button not keyboard accessible#111
dstrong23 wants to merge 1 commit into
stagefrom
fix-DOTCOM-180525-v2

Conversation

@dstrong23

Copy link
Copy Markdown
Collaborator

Summary

Fixes WCAG 2.1.1 Keyboard (Level A) violation on the error toast in all verb-widget pages, including the AI Summary Generator.

Jira: https://jira.corp.adobe.com/browse/DOTCOM-180525

Changes

acrobat/blocks/verb-widget/verb-widget.js

1. errorCloseBtndiv → native button

-  const errorCloseBtn = createTag('div', { class: 'verb-errorBtn', role: 'button', tabindex: '0', 'aria-label': 'Close error' });
+  const errorCloseBtn = createTag('button', { class: 'verb-errorBtn', type: 'button', 'aria-label': 'Close error' });

Native <button> elements are focusable and keyboard-activatable (Enter/Space) without requiring a custom keydown handler.

2. Widget click guard — e.srcElemente.target.closest()

-    if (e.srcElement.classList.value.includes('error')) { return; }
+    if (e.target.closest('.verb-errorBtn, .error')) { return; }

e.srcElement is deprecated. The old string check also matched close-icon error classes on the SVG inside the close button, swallowing clicks before they reached the close handler.

Testing

  1. Go to https://www.adobe.com/acrobat/online/ai-summary-generator.html
  2. Tab to Select a file, activate with Enter
  3. Select an unsupported file type — toast appears
  4. Tab — focus should land on the Close button
  5. Press Space or Enter — toast should dismiss
  6. Verify clicking the X icon directly also dismisses the toast (regression check for change 2)

Supersedes PR #110 (branch renamed from fix/DOTCOM-180525-v2)

…essible

- Change errorCloseBtn from div[role=button] to native <button> so keyboard
  users can Tab to it and activate with Enter/Space without a custom keydown handler
- Update widget click guard from deprecated e.srcElement to e.target.closest()
  with a precise selector, preventing the guard from swallowing clicks on the
  close button SVG child (which had 'close-icon error' classes matching the old check)

Fixes WCAG 2.1.1 Keyboard (Level A) - DOTCOM-180525
@aem-code-sync

aem-code-sync Bot commented May 5, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@markovicpredrag1209

Copy link
Copy Markdown
Collaborator
Screenshot 2026-05-11 at 13 43 49

hey dave, there is a problem with the error message showing with these changes

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