Skip to content

Commit b53fa09

Browse files
highoncomputersrootkirk-loretz-fsnRobinMalfait
authored
fix: exclude iframes from focus-visible auto outline in Preflight (tailwindlabs#20292)
## Description Firefox's UA stylesheet already sets `iframe:focus-visible { outline-style: none; }`, so Preflight's `:-moz-focusring { outline: auto; }` rule overrides that and applies an unwanted auto outline to focused iframes. Adding `:where(:not(iframe))` to the selector preserves the improved focus ring behavior for all other elements while respecting Firefox's native iframe focus styling. Fixes tailwindlabs#19795 Edit by @RobinMalfait ## Test plan Before: <img width="1054" height="383" alt="file-f833142116d36e1e620290b97455f001" src="https://github.com/user-attachments/assets/81aa170b-2cef-4964-934d-61f258335e1a" /> After: <img width="1056" height="310" alt="file-400d9214fedf5b43693e10580a4869de" src="https://github.com/user-attachments/assets/8f8bb81d-6070-425d-8820-327bf9e88e79" /> --------- Co-authored-by: root <root@localhost.localdomain> Co-authored-by: Kirk Loretz <kirk-loretz-fsn@users.noreply.github.com> Co-authored-by: Robin Malfait <malfait.robin@gmail.com>
1 parent ef79119 commit b53fa09

6 files changed

Lines changed: 7 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Allow `@tailwindcss/cli` in `--watch` mode to use polling with `--poll` when filesystem events are unreliable or unavailable ([#20297](https://github.com/tailwindlabs/tailwindcss/pull/20297))
1313
- Canonicalization: match arbitrary hex colors against theme colors case-insensitively (e.g. `bg-[#fff]` and `bg-[#FFF]``bg-white`) ([#20298](https://github.com/tailwindlabs/tailwindcss/pull/20298))
14+
- Prevent Preflight from overriding Firefox's native `iframe:focus-visible` outline styles ([#20292](https://github.com/tailwindlabs/tailwindcss/pull/20292))
1415

1516
## [4.3.2] - 2026-06-26
1617

integrations/cli/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2903,7 +2903,7 @@ test(
29032903
border-color: inherit;
29042904
border-collapse: collapse;
29052905
}
2906-
:-moz-focusring {
2906+
:-moz-focusring:where(:not(iframe)) {
29072907
outline: auto;
29082908
}
29092909
progress {

packages/@tailwindcss-postcss/src/__snapshots__/index.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ exports[`\`@import 'tailwindcss'\` is replaced with the generated CSS 1`] = `
110110
border-collapse: collapse;
111111
}
112112
113-
:-moz-focusring {
113+
:-moz-focusring:where(:not(iframe)) {
114114
outline: auto;
115115
}
116116

packages/tailwindcss/preflight.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ table {
170170
Use the modern Firefox focus style for all focusable elements.
171171
*/
172172

173-
:-moz-focusring {
173+
:-moz-focusring:where(:not(iframe)) {
174174
outline: auto;
175175
}
176176

packages/tailwindcss/src/__snapshots__/index.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ exports[`compiling CSS > prefix all CSS variables inside preflight 1`] = `
226226
border-collapse: collapse;
227227
}
228228
229-
:-moz-focusring {
229+
:-moz-focusring:where(:not(iframe)) {
230230
outline: auto;
231231
}
232232

packages/tailwindcss/src/source-maps/source-map.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ test('source maps trace back to @import location', async ({ expect }) => {
338338
^^^^^^^^^^^^^^^^^^^^^^^^^ CS @ 73:4-29 | ^^^^^^^^^^^^^^^^^^^^^^^^^ CS @ 166:2-27
339339
| 167 }
340340
74 } |
341-
75 :-moz-focusring { | 173 :-moz-focusring {
342-
^^^^^^^^^^^^^^^^ CT @ 75:2-18 | ^^^^^^^^^^^^^^^^ CT @ 173:0-16
341+
75 :-moz-focusring:where(:not(iframe)) { | 173 :-moz-focusring:where(:not(iframe)) {
342+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ CT @ 75:2-38 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ CT @ 173:0-36
343343
76 outline: auto; | 174 outline: auto;
344344
^^^^^^^^^^^^^ CU @ 76:4-17 | ^^^^^^^^^^^^^ CU @ 174:2-15
345345
| 175 }

0 commit comments

Comments
 (0)