Skip to content

fix(Tooltip): dismiss tooltip and popover on Escape key (WCAG 1.4.13)#511

Merged
mrholek merged 1 commit into
mainfrom
fix/tooltip-escape-dismiss
Jul 17, 2026
Merged

fix(Tooltip): dismiss tooltip and popover on Escape key (WCAG 1.4.13)#511
mrholek merged 1 commit into
mainfrom
fix/tooltip-escape-dismiss

Conversation

@mrholek

@mrholek mrholek commented Jul 17, 2026

Copy link
Copy Markdown
Member

Ports the vanilla tooltip Escape-key dismissal (coreui/coreui#1126, coreui-pro#609) to the React CTooltip and CPopover (a11y — WCAG 1.4.13 "Content on Hover or Focus"): a hover/focus tooltip or popover could not be dismissed from the keyboard.

  • While shown (_visible), a keydown listener is attached to document in the capture phase; on Escape it preventDefault() + stopPropagation() and calls handleHide(). Removed automatically when _visible flips false (effect cleanup on [_visible]).
  • Capture phase = the tooltip/popover dismisses before an ancestor dialog's own Escape handler (nested dismissal).
  • Applied to both CTooltip and CPopover (separate components in React).
  • Tests: dismiss-on-Escape + non-Escape-ignored for each component. Docs updated (tooltip Usage, popover Dismiss section).

@mrholek
mrholek merged commit cd54797 into main Jul 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant