Repository navigation
Conversation
Add a disabled field and param to Dropdown, Switch, Radio, Slider, TextBox, Picture and Menu/MenuItem, and guard every input handler so disabled widgets cannot be clicked, focused, dragged or typed into. Dim their drawing with a shared dim_color helper. CheckBox.disabled was declared but never read; it now blocks both mouse and keyboard toggling. ListBox disabled items are no longer selectable via single-select clicks or arrow keys, draggable, or hover-highlighted. Focus navigation now skips disabled widgets via Focusable.is_disabled(), and set_focus/force_focus no longer steal focus for them. Document the new params in docs.md.
Focus navigation used only !hidden, so widgets hidden via z_index_hidden or inside a deactivated/absent parent layout were still Tab-reachable, and force_focus() bypassed even hidden. Add Focusable.is_focus_visible() using the same predicates as mouse hit-testing (is_visible, is_parent_visible(true), !has_parent_deactivated) and use it in has_focusable(), set_focus() and force_focus(), so an unfocusable widget no longer steals focus from the currently focused one.
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.
Problem
Focus navigation used only
!f.hiddenas its visibility test (Focusable.has_focusable()). Mouse hit-testing, by contrast, requiresis_visible() && is_parent_visible(true) && !has_parent_deactivated(). As a result:z_index = z_index_hidden(accordion, hideable, grid and treeview components) were still reachable with Tab andset_focus_first/last;force_focus()(used byButton.focus()andTextBox.focus()) bypassed even thehiddencheck and could steal focus from the real focused widget.Change
Add
Focusable.is_focus_visible()using the same predicates as mouse hit-testing, and use it inhas_focusable(),set_focus()andforce_focus(). An unfocusable widget is rejected beforeunfocus_all()runs, so it can no longer clear focus from the currently focused widget.Notes
interface_focusable.v). Once Make disabled state valid and complete across all interactive widgets #631 merges, this PR's diff shrinks to the single commit238809f—1 file changed, 15 insertions(+), 4 deletions(-).v fmton the changed file and a type-check build: no new errors relative to unmodifiedmaster, whose build is already broken with V 0.5.2 (same pre-existing errors as Make disabled state valid and complete across all interactive widgets #631).