跳到正文
Skillpedia
网站与界面(前端)75k · #2850

focus-not-obscured

它能做什么

这项技能检查固定的页面元素是否遮住了获得键盘焦点的项目。适用于构建吸顶菜单、Cookie 横幅和聊天小组件的开发者。

适用场景

  • ✓当你用 Tab 键浏览页面时,吸顶标题遮住了链接的时候。
  • ✓当 Cookie 横幅遮住了键盘用户正在填写的表单字段的时候。
  • ✓当你添加了固定在屏幕上的聊天启动按钮或促销栏的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/focus-not-obscured/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/focus-not-obscured/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请检查我的吸顶标题在我使用 Tab 键时,是否会遮住获得焦点的链接。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会在吸顶元素显示的情况下测试键盘焦点,查找获得焦点的项目滚动到它们下方的情况。它会建议使用 scroll-padding,或调整覆盖层的尺寸。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Keep focused elements unobscured

A visible focus ring is not enough if the focused element sits behind a sticky header or footer. Keyboard users need to see the actual focused control and the focus indicator at the same time in order to continue the task.

Quick Reference

  • Sticky UI must not cover the focused control while keyboard users tab through the page
  • Use scroll-padding or equivalent spacing when fixed headers or footers are present
  • Test with cookie banners, chat widgets, and consent bars open
  • Re-test at zoomed and mobile layouts where overlap problems usually appear

Check

Audit keyboard focus with all sticky UI active. Check headers, footers, cookie banners, promo bars, and chat launchers for cases where the focused element scrolls underneath them.

Fix

Add layout spacing such as scroll-padding, reduce overlay height, or change focus/scroll behavior so the focused element remains visible when tabbing.

Explain

Explain WCAG Focus Not Obscured, why fixed-position UI commonly breaks it, and how scroll-padding and overlay layout choices prevent the issue.

Code Review

Review sticky layout, focus styles, overlays, and keyboard navigation related to Keep focused elements unobscured. Flag exact selectors, breakpoints, or UI states where focused controls can be covered.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/accessibility/focus-not-obscured

常见问题

什么是 scroll-padding?

它是一项 CSS 设置,当浏览器滚动到获得焦点的项目时,会在顶部或底部留出空间,使其保持可见。

它检查哪些元素?

页眉、页脚、Cookie 横幅、促销栏和聊天启动按钮。

这些问题通常在什么时候出现?

这项技能指出,重叠问题常出现在缩放和移动端布局中,因此建议在这些情况下重新测试。

详情

作者的原始描述

Use when reviewing sticky navigation, consent banners, chat widgets, skip links, or any fixed-position UI. Validate the actual tab order and viewport behavior at realistic zoom levels.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2850
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能