focus-styles
Fungsinya
Skill ini memeriksa apakah situs menampilkan garis tepi yang terlihat saat pengguna keyboard berpindah antar kontrol. Skill ini cocok untuk developer dan desainer yang menginginkan gaya yang aksesibel.
Kapan dipakai
- ✓Saat CSS Anda menghapus garis tepi bawaan dari tombol atau tautan.
- ✓Saat pengguna keyboard tidak dapat melihat kontrol mana yang sedang dipilih.
- ✓Saat Anda mendesain gaya tombol atau tautan kustom.
Link skill
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/focus-styles/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Bisakah Anda memastikan tombol saya menampilkan garis tepi yang terlihat saat saya memakai keyboard?”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Agent mencari garis tepi yang dihapus di lembar gaya dan memeriksa adanya pengganti yang terlihat. Agent menyarankan gaya focus-visible dengan kontras yang cukup dan jarak (offset) yang jelas.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Provide visible custom focus indicators
Users who navigate by keyboard (people with motor disabilities, power users, people in assistive technology contexts) rely entirely on focus indicators to know where they are on the page. Removing outlines without replacement makes an entire site unusable for keyboard users. WCAG 2.4.7 requires a visible focus indicator, and WCAG 2.4.13 defines a stronger size-and-contrast target for custom indicators.
Quick Reference
- Never use outline: none or outline: 0 without a visible :focus-visible replacement
- Use :focus-visible instead of :focus to show indicators only during keyboard navigation
- Focus indicators must have 3:1 contrast ratio against adjacent colors (WCAG 2.2)
- Provide at least 2px solid outline with an offset for a high-quality focus ring
- If a focus ring is drawn with pseudo-elements, verify it is anchored to the correct positioned element and not clipped by
overflow: hidden - If the component uses a stretched-link pattern, verify the visible focus ring follows the actual interactive element rather than a parent wrapper by accident
Check
Find all instances of outline: none, outline: 0, or :focus { outline: none } in this CSS. Check if they provide an alternative visible focus indicator. If the replacement uses pseudo-elements, also verify the ring cannot be clipped or misplaced by overflow or missing positioning context.
Fix
Replace outline: none on :focus with :focus-visible styles that provide a clearly visible custom focus ring with appropriate contrast.
Explain
Explain the difference between :focus and :focus-visible, why focus styles matter for accessibility, and how to design an accessible focus ring.
Code Review
Review stylesheets, component styles, and responsive states related to Provide visible custom focus indicators. Flag exact selectors, declarations, or breakpoints that violate the rule in the rendered UI.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/css/focus-styles
Pertanyaan umum
Mengapa tidak sekadar menghapus garis tepi?
Pengguna keyboard bergantung pada garis tepi untuk mengetahui posisi mereka, sehingga menghapusnya membuat situs sulit digunakan.
Apa itu focus-visible?
Itu adalah selektor CSS yang menampilkan gaya fokus terutama saat navigasi keyboard, bukan setelah klik mouse.
Kontras apa yang dibutuhkan?
Skill menyebutkan rasio kontras 3 banding 1 terhadap warna di sekitarnya untuk indikator fokus.
Detail
Deskripsi asli dari pembuat
Use when reviewing stylesheets, component styles, and responsive behavior related to Provide visible custom focus indicators. Check the rendered layout across breakpoints and interaction states before proposing a fix.
Popularitas
- Bintang GitHub
- 75k
- Peringkat
- #2852
- Lisensi
- MIT
- Diperbarui
- 31/10/2026
Komentar
- …
Skill lain dari repositori ini
frontendchecklist
75kMemeriksa kode frontend dan halaman langsung terhadap lebih dari 380 aturan untuk aksesibilitas, kecepatan, SEO, dan keamanan, dengan alat baris perintah.
frontend-checklist-global
75kMengaudit proyek frontend terhadap seluruh 386 aturan Front-End Checklist, dan memberikan perbaikan spesifik untuk setiap masalah yang ditemukan.
404-page
75kMemeriksa bahwa halaman tidak ditemukan Anda menawarkan tautan yang membantu dan mengembalikan status 404 yang sebenarnya, untuk membantu pengunjung yang tersesat.
about-page
75kMeninjau apakah situs Anda memiliki halaman Tentang yang jelas yang menjelaskan siapa yang mengelolanya, untuk membangun kepercayaan pengunjung dan mesin pencari.
Skill serupa
canvas
394kMemungkinkan agent Anda menampilkan widget visual yang di-hosting di panel Mac yang terhubung, lalu menyembunyikan panel atau memindahkannya ke halaman lain.
control-ui
394kMembantu agent Anda mengatur dan memecahkan masalah OpenClaw Control UI, termasuk sesi, dasbor, dan Gateway yang terhubung.
diagram-maker
394kMembantu agent Anda membuat diagram yang jelas sebagai SVG, HTML, atau Excalidraw yang dapat diedit untuk proses, arsitektur sistem, dan sketsa papan tulis.