Skip to content

fix: stop native tooltips overlapping custom popovers#27

Merged
rrbe merged 2 commits into
mainfrom
fix/tooltip-popover-overlap
Jun 3, 2026
Merged

fix: stop native tooltips overlapping custom popovers#27
rrbe merged 2 commits into
mainfrom
fix/tooltip-popover-overlap

Conversation

@rrbe
Copy link
Copy Markdown
Owner

@rrbe rrbe commented Jun 3, 2026

问题

两处「原生 tooltip 叠加在自定义浮层上、遮挡视线」的问题:

  • pr-review-status:unresolved badge 既设了原生 title,又有 click 出来的详情 popover;并且 popover 内每行的文件路径 <span> 也带原生 title。hover 时浏览器原生 tooltip 会盖在打开的 popover 上。
  • star/fork/watch:counter <span> 自带 GitHub 的原生 title(精确数字,如 title="1,234" 配可见的 1.2k),和我们 hover 弹出的人员 popup 叠加。(经 Chrome 实测确认,叠加来自 counter 自身的 title,不是按钮的 <tool-tip>。)

另外,pr-review-status 的列表查询此前会为列表里每个 PR、每条线程贪婪拉取 path/line/author/bodyText/url:在 review 线程多的仓库可能产生超大 GraphQL 响应、触发成本/超时限制,而一旦报错,整个 review 状态 UI 会静默消失(降不到计数)。

改动

  • pr-review-status
    • 有 popover 的 badge 不再设 title(popover 本身就是更丰富的摘要)。
    • popover 内每行的完整路径改用 aria-label 承载(读屏可读),不再用 title,从根上消除浮层内部的原生 tooltip 叠加。
    • 列表查询 FETCH_PR_REVIEW_STATUSES 改为只取计数(totalCount + 每条线程 isResolved)。沉重的线程详情改为按需、单 PR 拉取:只在某个 badge 的 popover 首次点开时请求(新增 FETCH_PR_REVIEW_THREAD_DETAILS),以 MAX_REVIEW_THREADS=100 封顶。popover 打开时显示 Loading,失败/为空时降级为可重试的「Couldn't load thread details.」;计数 badge 不再依赖详情请求,详情挂掉也不会让整行空白。
  • watch-fork-star:mouseenter 时把 counter 的原生 title 暂存到 data-bg-wfs-title 并摘除,mouseleave / cleanup 还原。因为 popup 在 300ms 弹出、早于浏览器原生 title 延迟,原生 tooltip 不会闪现。保留 aria-label(读屏无障碍)。

测试

pnpm test 182 passed。新增/更新断言:

  • 有 popover 的 badge 无 title;popover 行用 aria-label 而非 title
  • 详情在点开前不发起请求、点开后按需加载一次、空结果显示可重试提示并真的重试。
  • 列表查询只返回计数,且 GraphQL query 不含 bodyText/comments(;approve 清缓存同时覆盖新增的 reviewdetails
  • wfs counter hover 摘除 title / leave 还原 / cleanup 中途还原。

审计

全项目其余 title(commit-tags / pr-collapse-expand / better-top-repos / diff-stats / pr-branch-names)所在元素都没有会同时出现的自定义浮层,不存在叠加;pr-approve-now 是居中模态弹窗,不锚定、不叠加。同类问题仅这两处。

🤖 Generated with Claude Code

rrbe and others added 2 commits June 3, 2026 11:10
The pr-review-status badge set a native `title` and also opened a click
popover; on hover the browser tooltip overlapped the open popover. The
star/fork/watch counters carry GitHub's own `title` (the exact count),
which overlapped our hover popup.

- pr-review-status: drop the `title` on badges that have a popover (the
  popover is the richer summary). Keep the `title` only on badges with
  no expandable details.
- watch-fork-star: stash and remove the counter's native `title` on
  mouseenter, restore on mouseleave / cleanup. Our popup opens before
  the browser's title delay, so the native tooltip never shows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Address two review findings on the unresolved-review-thread popover:

- The list-page query (FETCH_PR_REVIEW_STATUSES) now fetches counts only
  (totalCount + per-thread isResolved). The heavy path/author/body detail
  query runs lazily, one PR at a time, only when a badge's popover is first
  opened (new FETCH_PR_REVIEW_THREAD_DETAILS), capped at MAX_REVIEW_THREADS.
  The popover shows a loading state and degrades to a retryable
  "couldn't load" message on failure; the count badge no longer depends on
  the detail fetch, so a failed/slow detail query never blanks the row.

- Popover rows now carry the full path on aria-label instead of a native
  title, so hovering a truncated path no longer spawns a browser tooltip
  over the custom popover.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@rrbe rrbe merged commit 4145808 into main Jun 3, 2026
1 check passed
@rrbe rrbe deleted the fix/tooltip-popover-overlap branch June 3, 2026 04:34
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