Fix releasing focus when leaving command mode

The fix for #8223 in 6f21accfae
was misguided: We don't really care about the statusbar being hidden,
controlled release of keyboard focus needs to happen in any case where
we're hiding the command widget (as that's when we lose keyboard focus).

Fixes #8750.
This commit is contained in:
Florian Bruhin 2025-10-25 16:43:06 +02:00
parent 1e4ddc2c6b
commit b646d606d7
3 changed files with 20 additions and 4 deletions

View File

@ -15,6 +15,17 @@ breaking changes (such as renamed commands) can happen in minor releases.
// `Fixed` for any bug fixes.
// `Security` to invite users to upgrade in case of vulnerabilities.
[[v3.6.1]]
v3.6.1 (unreleased)
-------------------
Fixed
~~~~~
- A regression in v3.6.1 where the page didn't have keyboard focus after closing
the completion, so e.g. typing in an input field after hinting didn't work.
(#8750)
[[v3.6.0]]
v3.6.0 (2025-10-24)
-------------------

View File

@ -286,20 +286,16 @@ class StatusBar(QWidget):
strategy = config.val.statusbar.show
tab = self._current_tab()
if tab is not None and tab.data.fullscreen:
self.release_focus.emit()
self.hide()
elif strategy == 'never':
self.release_focus.emit()
self.hide()
elif strategy == 'in-mode':
try:
mode_manager = modeman.instance(self._win_id)
except modeman.UnavailableError:
self.release_focus.emit()
self.hide()
else:
if mode_manager.mode == usertypes.KeyMode.normal:
self.release_focus.emit()
self.hide()
else:
self.show()
@ -371,6 +367,7 @@ class StatusBar(QWidget):
def _hide_cmd_widget(self):
"""Show temporary text instead of command widget."""
log.statusbar.debug("Hiding cmd widget")
self.release_focus.emit()
self._stack.setCurrentWidget(self.txt)
self.maybe_hide()

View File

@ -103,3 +103,11 @@ Feature: Using completion
And I run :completion-item-focus next
And I run :cmd-set-text -s :set
Then the completion model should be option
Scenario: Page focus after using completion (#8750)
When I open data/insert_mode_settings/html/input.html
And I run :cmd-set-text :
And I run :mode-leave
And I run :click-element id qute-input
And I run :fake-key -g someinput
Then the javascript message "contents: someinput" should be logged