cpsTooltip: can't be dismissed with Escape or hovered over (WCAG 1.4.13)

已关闭
#916 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@fateeand 已经在做这个了。

开始于 2026年11月3日。

  • #931 来自 @fateeand —— 已合并

评估

难度
3/5
预计耗时
1-2 天
新手友好度
70/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃

调研方向

Start in projects/cps-ui-kit/src/lib/directives/cps-tooltip/cps-tooltip.directive.ts: the host bindings around lines 38-48, onMouseLeave(), and _positionAndShow(), where popup listeners are added only for persistent tooltips. Add an Escape handler for hover, focus and trigger cases, and mouseenter/mouseleave handling on the popup so a pending hide is cancelled. Done when the Playwright spec in playwright/cps-ui-kit/directives/cps-tooltip.spec.ts covers Escape dismissal and hovering over the tooltip, and persistent, click and focus behaviour is unchanged.

由索引模型根据 Issue 内容生成。

描述

accessibility bug library

Problem

cpsTooltip doesn't meet WCAG 1.4.13 (Content on Hover or Focus) with its default settings (tooltipOpenOn="hover", tooltipPersistent=false):

  • Not dismissible: pressing Escape doesn't close an open tooltip. Users have to move the pointer or focus away from the trigger to hide content that may cover other parts of the page.
  • Not hoverable: moving the pointer from the trigger onto the tooltip closes it after tooltipCloseDelay (300 ms). Users can't keep the tooltip open while reading it or while zooming in on it.

Found in AUL on the Dashboard: truncated domain-card titles show the full name in a cpsTooltip. On hover or keyboard focus, Escape leaves the tooltip open, and moving the pointer onto the tooltip makes it disappear.

Where

  • projects/cps-ui-kit/src/lib/directives/cps-tooltip/cps-tooltip.directive.ts:38-48: the host bindings have no Escape key handler.
  • cps-tooltip.directive.ts onMouseLeave(): always schedules _destroyTooltip for non-persistent tooltips.
  • cps-tooltip.directive.ts _positionAndShow(): popup listeners (focusout, keydown) are only added for persistent tooltips. None of them are mouseenter/mouseleave listeners, so hovering over the popup can't cancel the pending hide.

Acceptance criteria

  • Pressing Escape while the trigger or the tooltip has focus, or while the tooltip is shown on hover, closes the tooltip. Focus stays where it was, and nothing else on the page handles that Escape press.
  • Moving the pointer from the trigger onto a visible tooltip keeps it open. It closes after tooltipCloseDelay once the pointer leaves both the trigger and the tooltip.
  • The current behaviour for persistent, click-opened and focus-opened tooltips stays the same, apart from the new Escape dismissal.
  • Playwright tests in playwright/cps-ui-kit/directives/cps-tooltip.spec.ts cover Escape dismissal and hovering over the tooltip.
主要语言
TypeScript
星标
9
派生
8
平均合并
1 天 1 小时
30 天内合并 PR
23

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AbsaOSS/cps-shared-ui 的其他 Issue

查看 AbsaOSS/cps-shared-ui 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。