Push Notification Tester - Online Generate & Receive
Register a service worker, subscribe to push, and send a test notification using a VAPID key pair. Step‑by‑step demo.
UD5 Toolkit
Test and compare :focus-visible vs :focus pseudo-classes in real time. Discover how browsers intelligently show focus rings only when you need them — for keyboard navigation, not mouse clicks.
tabindex="0"
tabindex="0"
—
<input>, <textarea>, <select>), most browsers also match :focus-visible on mouse click — because showing a focus indicator on text fields is always helpful for usability. Buttons and links typically only match :focus-visible via keyboard navigation.
/* ✅ Best Practice: Hide default focus, show only for keyboard */
:focus {
outline: none;
}
:focus-visible {
outline: 3px solid #3b82f6;
outline-offset: 2px;
box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
border-radius: 4px;
}
/* For older browsers, use the polyfill: */
/* npm install focus-visible */
/* import 'focus-visible'; */
:focus-visible is a CSS pseudo-class that applies styles only when the browser determines that a focus indicator should be visible. It represents the browser's best guess about when the user really needs to see a focus ring — typically when navigating via keyboard (Tab, arrow keys) rather than mouse click or touch.
Introduced by the CSS Selectors Level 4 specification, it helps solve a long-standing UX problem: focus rings are essential for keyboard users but visually annoying for mouse users.
:focus — matches any element receiving focus, regardless of input modality (mouse, keyboard, touch, or programmatic). The focus ring appears every single time.
:focus-visible — matches only when the browser believes the user needs to see the focus indicator. Typically:
Native support is excellent across all modern browsers:
| Browser | Version | Support |
|---|---|---|
| Chrome | 86+ | ✅ Full |
| Firefox | 85+ | ✅ Full |
| Safari | 15.4+ | ✅ Full |
| Edge | 86+ | ✅ Full |
| Samsung Internet | 16+ | ✅ Full |
| iOS Safari | 15.4+ | ⚠️ Partial |
For older browser support, use the official focus-visible polyfill from WICG.
The polyfill adds a .focus-visible class to focused elements when the browser would have matched :focus-visible. Here's how to use it:
npm install focus-visible
// In your JS entry file:
import 'focus-visible';
/* In your CSS, use both to cover all browsers: */
:focus { outline: none; }
:focus-visible,
.focus-visible {
outline: 3px solid #3b82f6;
outline-offset: 2px;
}
The polyfill is lightweight (~2KB) and works by simulating the browser's heuristic using JavaScript event listeners for keyboard and mouse input.
This is expected browser behavior and part of the specification's heuristic. Browsers determine when to match :focus-visible based on element type and context:
You cannot override this heuristic with CSS alone. If you truly need to suppress focus indicators on text inputs for mouse users, you'd need JavaScript-based solutions (though this is generally not recommended for accessibility reasons).
The recommended best practice combines both pseudo-classes for maximum compatibility and usability:
:focus { outline: none; }:focus-visibleoutline-offset to prevent the focus ring from touching the element edge.focus-visible class with the polyfill for older browsers❌ Avoid: :focus { outline: none; } without providing an alternative — this breaks keyboard accessibility entirely.
Absolutely! You're not limited to the browser's default outline. Here are some creative approaches:
/* Glowing ring */
:focus-visible {
outline: none;
box-shadow: 0 0 0 3px #fff, 0 0 0 6px #3b82f6;
border-radius: 6px;
}
/* Underline indicator */
:focus-visible {
outline: none;
border-bottom: 3px solid #3b82f6;
padding-bottom: 2px;
}
/* Inset ring */
:focus-visible {
outline: none;
box-shadow: inset 0 0 0 3px #3b82f6;
}
Just ensure the indicator is clearly visible and meets contrast requirements. The demo on this page uses a blue box-shadow ring for :focus-visible and a red one for :focus to clearly differentiate them.
:focus-visible is a crucial tool for accessibility because it:
Never use :focus { outline: none; } alone without providing a :focus-visible alternative — this creates an accessibility barrier for keyboard-only users.
Register a service worker, subscribe to push, and send a test notification using a VAPID key pair. Step‑by‑step demo.
Test your browser's built‑in speech recognition. Speak and see the transcribed text appear live. Must‑have for voice app devs.
Turn your browser screen into a full‑color flashlight or strobe. Adjust brightness and color. Simple utility.
Change the text input cursor color. See the effect live. Copy the minimal CSS. Simple but delightful.
See a comprehensive table of which modern web APIs your current browser supports. Includes WebGPU, AVIF, and more.
List all available TTS voices on your system. Test each with any text. Adjust rate and pitch. Find the best voice.
Paste your speech, set time limit, and practice with a pacing indicator (words per minute). Refine delivery.
Adjust opacity visually with a slider and see the different CSS representations (opacity property vs RGBA/HSLA). Copy best option.
Hear text spoken word by word with boundary events. See the exact index and character. Advanced TTS dev tool.
Tune your guitar using the browser microphone. Detects pitch and shows deviation from standard tuning. No installation, pure client-side audio processing.
Combine TTS with text highlighting. See each word colored as it is spoken. For e‑learning content creation. Local.
Drag a virtual ruler across your screen to measure pixel distances. Horizontal and vertical guides. Useful for UI designers checking alignment.
Play an audio file or use mic to see real‑time frequency bars. Choose colors. Great for music videos. Canvas.
Find the centroid (center of mass) of any convex polygon by entering vertex coordinates. Useful for physics and design.
Record your screen, window, or tab with audio directly in the browser. Download as WebM. No extension required.
Record your screen, window, or tab with audio directly in the browser. Download the recording as a WebM file. No upload.
Paste HTML and see a before/after comparison of minified output. Check the byte savings. All local.
See your website inside iframes at multiple breakpoints simultaneously. Side‑by‑side responsive testing.
Create a reflection effect for images or text using box‑reflect. Adjust direction and offset. Copy the CSS.
Visualize audio in real time from your microphone or uploaded audio file. See the waveform dance. Uses Web Audio API locally.
Play left‑only, right‑only, and frequency sweeps to test your speakers or headphones. Quick audio check.
Spin a colorful wheel that lands on Yes, No, or custom answers. Includes sound effects and adjustable probability. Local fun decision maker.
Select any HTML element on a page and capture its screenshot. Download as PNG. Perfect for bug reports. JavaScript API demo.
Paste a user agent string to get a human-readable breakdown of browser, operating system, and device. See your own current agent info automatically.
Create a custom element with named slots and see content projection in action. Learn Web Components basics.
Paste robots.txt content and parse it to check validity, find disallowed paths. Educational SEO tool. Local processing.
Paste a robots.txt file and validate its syntax. See if a specific user‑agent can access a path. Essential for webmasters.
Track attendance for multiple subjects. Mark present/absent and see percentage. Data in localStorage. Simple student tool.
Virtual flip coins thousands of times and see the heads/tails ratio converge to 50%. Interactive law of large numbers.
Measure your browser's GPU compute power using a simple WebGPU matrix multiplication. See raw FLOPS and compare with peers. Fully client‑side.