fix(greeter): return focus to the password field after a selector menu closes - #91
Open
iwasironman wants to merge 1 commit into
Open
fix(greeter): return focus to the password field after a selector menu closes#91iwasironman wants to merge 1 commit into
iwasironman wants to merge 1 commit into
Conversation
…u closes Picking a session with F3 left focus on the session selector, so the next keystroke went nowhere and the password field had to be reached again with Shift+Tab. Selecting a color scheme with F7 behaved the same way. tuigreet returns to the prompt, so switching between two sessions regularly is more keystrokes on the GUI greeter than on the TUI one. selectSession(), selectScheme() and closeMenusAndRestoreFocus() now prefer the password field while the password step is up, falling back to the selector that owns the menu when it is not (the user-selection step keeps its current behavior). Restoring the previously focused area instead does not work for pointer opens: a click focuses the selector before its onClick handler runs, so the "previous" focus is already the selector itself. Naming the password field outright keeps F3/F7, focus-ring activation and pointer clicks consistent. Escape closes the menu the same way, and Tab out of an open menu now steps forward from the password field rather than from the selector.
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
Picking a session with
F3leaves focus on the session selector. The next keystroke goes nowhere, so the password field has to be reached again withShift+Tabbefore typing.F7(color scheme) behaves the same way.For anyone who alternates between two sessions, that makes the GUI greeter more keystrokes than tuigreet, which returns to the prompt after its session picker:
F3→ pick → type/authenticateF3→ pick →Shift+Tab→ type/authenticateIt is most noticeable with
allow_empty_password = trueand a fingerprint reader, where the whole login is otherwise "press Enter, touch the sensor" and the strayShift+Tabis the only manual navigation left.Change
selectSession(),selectScheme()andcloseMenusAndRestoreFocus()now prefer the password field while the password step is up, falling back to the selector that owns the menu when it is not. A small helper expresses the target:Why not restore the previously focused area
That was the first attempt, and it fails for pointer opens. A click focuses the selector before its
onClickhandler runs, so the "previous" focus is already the selector itself and restoring it is a no-op — keyboard opens got fixed while mouse opens did not. It also reads oddly when the menu is opened from somewhere that is not the password field.Naming the password field outright keeps
F3/F7, focus-ring activation and pointer clicks behaving identically, and needs no storedInputArea*to keep valid.Behavior
F3/F7→ pick, password stepEscout of the menu, password stepTwo consequences worth flagging, both deliberate:
Tabout of an open menu now steps forward from the password field (→ login button) rather than from the selector (→ scheme selector). Happy to special-case this if you would rather keep the old stepping.enterPasswordStep()already sets focus itself.If you would rather this were opt-in, it is a small change to gate on a
greeter.tomlkey — say the word and I will add one.Testing
Built and exercised on CachyOS (Arch), niri session,
wlroots 0.20.2,greetd 0.10.3.just buildandjust build-releaseclean, no new warningsjust format-checkpassesjust run-nirifor the UI paths:F3/F7via keyboard,Esc, pointer clicks on both selectors, and Tab-to-selector-then-Enter — focus lands on the password field in every password-step case, and the user-selection step is unchangedrun-niriharness: installed to/usr/local, pointed/etc/greetd/config.tomlat it, and logged in repeatedly on a stack withpam_fprintdahead ofpam_unixandallow_empty_password = true. Picking a session returns focus to the password field, so login isF3→ pick → Enter → fingerprint with noShift+Tab.I did not find an existing issue for this one; it is adjacent to but separate from the auth-flow work in #90.