Repository navigation
fix(mix): add FocusVisibility.ensureInitialized and harden focus-visible tracking - #1101
Merged
Merged
Conversation
…ble tracking Co-authored-by: Leo Farias <leoafarias@users.noreply.github.com>
- Notify on every highlight-mode change again. Skipping it while the pointer flag was set left a stale focus ring after alwaysTraditional, a touch press, and a switch back to automatic. - FocusVisibility.ensureInitialized now initializes the widgets binding and just creates the tracker; drop the HardwareKeyboard.clearState re-add, which only mattered in tests. - Move the ensureInitialized test to its own file so it fails without the call, add a regression test for the mode notification, test the alwaysTraditional no-rebuild path, and drop the clearState test. - Say the ensureInitialized and strategy-change caveats once, in FocusVisibility, and split the CHANGELOG entry in two.
leoafarias
marked this pull request as ready for review
October 20, 2026 18:00
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issue
Follow-up to #1099. It addresses the Codex review findings there and should merge before the 2.3.0 release (#1102).
Description
Hardens
FocusVisibilitybefore it ships.FocusVisibilityandFocusVisibilityScopeare still unreleased, so making the scope afinal classis not a breaking change yet.FocusVisibility.ensureInitialized(). Tracking otherwise starts on first use, so a mouse click on a non-Mix screen that opens one with an autofocused Mix control used to be missed, and the control showed a focus ring. The method also initializes the widgets binding and is safe to call more than once.alwaysTraditional, no longer rebuildsFocusVisibilityScopedependents. Highlight-mode changes always notify.FocusVisibilityScopeis now afinal class. The docs say once thatonFocusVisibledoesn't apply CSS's text-input exception and thatonFocusedcovers it.Changes
packages/mix/lib/src/core/focus_visibility.dart:ensureInitialized, the expanded key filter, the notification gating andfinal class.packages/mix/test/src/core/focus_visibility_test.dart: tests foralwaysTraditional, touch,automaticsequence (a regression test for an earlier dedup version that left the ring visible)alwaysTraditionalandalwaysTouchbehaviouralwaysTraditionalrequestFocusinonPointerDownpackages/mix/test/src/core/focus_visibility_initialization_test.dart: theensureInitializedtest. It's in its own file because once any test readsFocusVisibility, tracking stays on for the rest of the isolate, and this test would pass without the call.variant.dartandwidget_state_variant_mixin.dart, plusCHANGELOG.md.Review Checklist
btwld/mix-docsalongside fix(mix): show focus-visible only after keyboard input #1099.