Skip to content

fix: exclude iframes from focus-visible auto outline in Preflight#20292

Merged
RobinMalfait merged 4 commits into
tailwindlabs:mainfrom
highoncomputers:fix/preflight-iframe-focus-visible
Jul 2, 2026
Merged

fix: exclude iframes from focus-visible auto outline in Preflight#20292
RobinMalfait merged 4 commits into
tailwindlabs:mainfrom
highoncomputers:fix/preflight-iframe-focus-visible

Conversation

@highoncomputers

@highoncomputers highoncomputers commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

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 #19795

Edit by @RobinMalfait

Test plan

Before:
file-f833142116d36e1e620290b97455f001

After:
file-400d9214fedf5b43693e10580a4869de

@highoncomputers highoncomputers requested a review from a team as a code owner July 1, 2026 01:50
@greptile-apps

greptile-apps Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Reviews (4): Last reviewed commit: "update integration test snapshots" | Re-trigger Greptile

*/

:-moz-focusring {
:-moz-focusring:where(:not(iframe)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Preflight Snapshots Stay Stale

This selector changes the generated Preflight CSS, but the checked-in expected outputs still contain the old :-moz-focusring rule. The Preflight and CLI tests that compare generated CSS can fail with a snapshot mismatch until those expected outputs are updated.

Comment thread packages/tailwindcss/preflight.css
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: edf3c626-f4ec-46bf-bca5-0d585ad542ea

📥 Commits

Reviewing files that changed from the base of the PR and between 005b8bd and fb662db.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • integrations/cli/index.test.ts
✅ Files skipped from review due to trivial changes (2)
  • CHANGELOG.md
  • integrations/cli/index.test.ts

Walkthrough

This change updates the Firefox focus-ring selector in preflight.css to :-moz-focusring:where(:not(iframe)), leaving the outline: auto declaration unchanged. The source-map test snapshot and CLI snapshot are updated to match the new selector text and source-range marker, and the changelog adds a corresponding fixed entry.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: excluding iframes from Preflight's Firefox auto-outline rule.
Description check ✅ Passed The description matches the code changes and explains the iframe focus outline fix accurately.
Linked Issues check ✅ Passed The PR implements the linked issue's requested selector change to preserve Firefox's native iframe focus styling.
Out of Scope Changes check ✅ Passed The extra changelog and snapshot updates are directly tied to the iframe focus-outline fix and are in scope.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

root and others added 2 commits July 2, 2026 12:18
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.

Closes tailwindlabs#19795

Co-authored-by: Kirk Loretz <kirk-loretz-fsn@users.noreply.github.com>
@RobinMalfait RobinMalfait force-pushed the fix/preflight-iframe-focus-visible branch from 0250685 to 005b8bd Compare July 2, 2026 10:23
*/

:-moz-focusring {
:-moz-focusring:where(:not(iframe)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Snapshot Still Stale The generated Preflight output now contains :-moz-focusring:where(:not(iframe)), but the CLI integration inline snapshot still expects :-moz-focusring {. When that CLI test compares the generated CSS against the inline snapshot, it can still fail with a snapshot mismatch. Please update the remaining inline snapshot along with the checked-in snapshot files.

*/

:-moz-focusring {
:-moz-focusring:where(:not(iframe)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 CLI Snapshot Still Stale

The generated Preflight selector changed here, but the CLI integration inline snapshot still expects :-moz-focusring { for the @import 'tailwindcss' output. When that test compares the generated CSS, it will receive :-moz-focusring:where(:not(iframe)) { and fail the snapshot match. Please update the remaining CLI inline snapshot with this selector change.

@RobinMalfait RobinMalfait enabled auto-merge (squash) July 2, 2026 10:35

@RobinMalfait RobinMalfait left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just make sure that next time you run the tests 💪

@RobinMalfait RobinMalfait merged commit b53fa09 into tailwindlabs:main Jul 2, 2026
9 checks passed
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.

Preflight applies auto outline to focus-visible iframes

2 participants