Skip to content

Restore lock screen password focus when waking from blank (#14613) - #14882

Closed
Sebo1411 wants to merge 1 commit into
omacom:quattrofrom
Sebo1411:fix/issue-14613-lockscreen-focus-on-wake
Closed

Sebo1411 wants to merge 1 commit into
omacom:quattrofrom
Sebo1411:fix/issue-14613-lockscreen-focus-on-wake

Conversation

@Sebo1411

Copy link
Copy Markdown
Contributor

Summary

When waking up from DPMS display blanking or system suspend/resume, the lock screen's password input field can lose active focus. Previously, LockView only invoked forcePasswordFocus() on component completion and when inputEnabled transitioned to true, leaving the field unfocused upon display wake unless explicitly clicked.

Fixes #14613

Solution

  • In shell/plugins/lock/LockView.qml, add an onDisplaysBlankChanged handler that re-requests focus via Qt.callLater(forcePasswordFocus) when !displaysBlank && inputEnabled.
  • Expose passwordActiveFocus on LockView for focus state assertions.
  • Add an automated regression test and fixture in test/shell.d/lock-wake-focus-test.sh and test/shell.d/fixtures/lock-wake-focus/shell.qml.

Verification

  • Tested with ./test/cli and test/shell.d/lock-wake-focus-test.sh.

@Sebo1411

Copy link
Copy Markdown
Contributor Author

@greptile review

@greptile-apps

greptile-apps Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issue remains in the reviewed changes.

Summary

Restores password focus when the lock window becomes active or focus falls back to its empty content area.

  • The lock window restores password focus when its active focus is lost.

Reviews (11) · Last reviewed commit: "Restore lock screen password focus when ..." · Reviewed by Greptile

@Sebo1411

Copy link
Copy Markdown
Contributor Author

@greptile review

@Sebo1411

Copy link
Copy Markdown
Contributor Author

@greptile review

@jandrusk

Copy link
Copy Markdown

Thanks! Could you confirm this covers the suspend path in #14613? There the lid closes and the machine suspends, so I'm not sure displaysBlank ever goes true and back to false, and if it doesn't, this handler never fires. As written it looks like a direct fix for #12587 (focus lost after DPMS wake), which is worth linking too. A note on what you tested on real hardware (DPMS blank → wake, and lid close → suspend → resume) would help.

@Sebo1411

Copy link
Copy Markdown
Contributor Author

In addition to onDisplaysBlankChanged covering DPMS unblanking (#12587), I added a Connections listener on root.Window.window for both onActiveChanged and onActiveFocusItemChanged.

This directly handles the suspend/resume flow reported in #14613:

  • When resuming from system suspend (lid close/open or systemctl suspend), libseat/libinput unbinds and re-enumerates keyboard devices, causing Qt Quick to clear activeFocusItem or transition window active state.
  • onActiveChanged and onActiveFocusItemChanged automatically re-claim focus for passwordInput via Qt.callLater(root.forcePasswordFocus) whenever the lock window is active and inputEnabled, even if displaysBlank never toggled.

Linked #12587 in the commit description as well.

@Sebo1411

Copy link
Copy Markdown
Contributor Author

@greptile review

Comment thread test/shell.d/lock-wake-focus-test.sh Resolved
@Sebo1411
Sebo1411 force-pushed the fix/issue-14613-lockscreen-focus-on-wake branch from f972417 to 1d63d57 Compare October 12, 2026 20:09
@Sebo1411

Copy link
Copy Markdown
Contributor Author

@greptile review

@omarchybot

Copy link
Copy Markdown
Collaborator

Read at 1d63d57 by Claude Opus 5.5 in Claude Code. This pass stopped before verification: the second opinion (Codex Medium) answers, but omabot's daily budget of reviews is spent, so classifying this as a bug fix has not been confirmed by a second model, and omabot does not test or label an item until two models agree on what it is. Nothing was run on a worker, and no labels were added.

One thing the next pass and the maintainer will need: #8560 makes the same fix to shell/plugins/lock/LockView.qml and is older (opened 2026-08-27, also against quattro). It takes focus back whenever the password field loses it while the lock is accepting input, which covers the suspend/resume path from #14613 as well as the DPMS blank/wake path from #12587. Several people have confirmed it on hardware in that thread, including the DPMS case. That makes these two competing fixes, not duplicates, so both stay open. The behavioural fixture in test/shell.d/lock-wake-focus-test.sh is something #8560 lacks, since its test only matches the source text.

Waiting on the next review pass, once the second opinion is available again; the choice between the two fixes is the maintainer's.

Comment thread shell/plugins/lock/LockView.qml Resolved
Comment thread test/shell.d/lock-wake-focus-test.sh Resolved
@Sebo1411
Sebo1411 force-pushed the fix/issue-14613-lockscreen-focus-on-wake branch from a258669 to 0135402 Compare October 30, 2026 17:59
@Sebo1411
Sebo1411 force-pushed the fix/issue-14613-lockscreen-focus-on-wake branch from 0135402 to d55d05a Compare October 30, 2026 18:11
@Sebo1411
Sebo1411 force-pushed the fix/issue-14613-lockscreen-focus-on-wake branch from d55d05a to 9f79c20 Compare October 30, 2026 18:17
@Sebo1411
Sebo1411 force-pushed the fix/issue-14613-lockscreen-focus-on-wake branch from 9f79c20 to d842e25 Compare October 30, 2026 18:22
@Sebo1411
Sebo1411 force-pushed the fix/issue-14613-lockscreen-focus-on-wake branch from d842e25 to 391c3c9 Compare October 30, 2026 18:33
@omarchybot omarchybot added the bug Something isn't working label Nov 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 391c3c99 by Claude Opus 5.5 in Claude Code, with Codex at medium effort as the second opinion. Both classify this as a bug fix, and it now carries bug. Nothing was run on a worker this pass, for the reason below.

Competing fixes. Several open pull requests fix this same focus loss in LockView.qml. The one being brought forward is #8560 by @robouk, which is older (opened 2026-08-27) and already carries verified. It takes focus back whenever the password field loses it while input is enabled, wherever focus went, and again when a password check ends. My earlier comment here said #8560's test only matched the source text; that is no longer true, since it now has a behavioural fixture (lock-focus-recovery) that hosts the real LockView in a window.

Against that, this change acts in fewer cases. Both handlers return early unless win.active is true. onActiveFocusItemChanged only refocuses when focus falls to nothing or to contentItem, so if another item takes focus and keeps it, nothing takes it back. And if something takes focus during a password check, there is no handler for when the check ends. Codex was asked to rank the fixes without being shown my answer. It ranked them #8560, #12435, #14882, #7164, and named the same three gaps. It also pointed out that the fixture here clears the decoy's focus before checking, so it never tests the case where another item keeps focus. Its independence is not guaranteed, since it can read this session's notes. Neither of us found anything here that #8560 lacks and should take on, so nothing is being folded across.

This pull request stays open. Choosing between the fixes is the maintainer's decision, and nothing is needed from you for now.

@Sebo1411

Sebo1411 commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Closing as resolved upstream by #17277, which added Window.onActiveFocusItemChanged: Qt.callLater(restorePasswordFocus) to restore password input focus on wake and VT switch.

@Sebo1411 Sebo1411 closed this Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lock screen password field stops accepting input after lid close/reopen (suspend/resume); session stays locked, forces reboot

3 participants