Repository navigation
fix(tabs): keep focus in the listing after switching tabs with the mouse - #1932
Merged
Merged
Conversation
A tab button is a plain GtkButton, so a click focuses it before `clicked` selects the tab. `TabWindow::select` then saved that button as the focus of the tab being left, and returning to the tab grabbed it again: the strip is shared chrome, always mapped and focusable, so the fallback to the listing never ran and keyboard focus stayed on the tab strip. Only save focus that is inside the tab's own content, so returning to a tab left by a click falls back to `focus_active()` and the listing. Closes lgse#1929
Collaborator
|
can you attach a video or images |
A restored session selects its tabs before their listings load, so `focus_active()` finds no column to focus and GTK puts its default focus on the first focusable widget, the footer's shortcuts button. Selecting the next tab saved that button as the left tab's focus, since it is inside the tab, and the tab's first show restored it. Save focus only when it is inside the tab's browser view. Focus in the tab's footer or header now falls back to `focus_active()` and the listing, as focus on the tab strip already did. Refs lgse#1929
Saving focus only inside the browser view dropped focus in the tab's sidebar or preview drawer, so a keyboard user returning to a tab landed in the listing instead of where they left. Save focus in any of the tab's panes and still drop it on the strip, header and footer. Refs lgse#1929
Contributor
Review and cleanupMerged Review against the description and #1929.
Fixes pushed
Tests removed
Validation
CI: all checks green. QA scenarios are skipped on PRs (dispatch only). |
5 tasks
wmfeht
pushed a commit
to wmfeht/strata-feature-map
that referenced
this pull request
Oct 30, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RQ23A9GfGFakM7LCfHpGaM
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.
Description
Returning to a tab could leave keyboard focus outside the file listing (#1929), in two ways:
gtk::Button, so a click focuses it beforeclickedrunsTabWindow::select.selectsaved that button as the focus of the tab being left, and returning to the tab grabbed it again. The strip is shared chrome, always mapped and focusable, so the grab succeeded and the fallback tofocus_active()never ran.focus_active()finds no column to focus and GTK puts its default focus on the first focusable widget, the footer's shortcuts button. Selecting the next tab saved that button as the left tab's focus, since it is inside the tab, and the tab's first show restored it, so the first Ctrl+Shift+ to a restored tab landed on the footer.selectnow saves the window's focus only when it is inside the tab's browser view (is_ancestor(&previous.content.browser.widget())). Focus anywhere else, on the tab strip or in the tab's footer or header, is dropped, so returning to the tab falls back tofocus_active()and the listing. Focus inside the browser, such as an open filter, is saved and restored as before.Tests, both failing without the change:
ui::window::composition::tabs::tests::returning_to_a_tab_left_by_a_tab_button_focuses_its_listingfocuses a tab button the way a click does, leaves the tab and returns to it.ui::window::composition::tabs::tests::a_restored_tab_shown_for_the_first_time_focuses_its_listingrestores three tabs and shows the two that were never shown.a_restored_session_opens_with_focus_in_the_listingguards the launch itself, which already focused the listing.wait_until_orlets the focus tests name the widget that holds focus when they time out.Visual evidence
Before the change (1.1.0, AUR): after switching tabs, the tab button keeps the focus ring and j/k do nothing.
recording_20261030_024055_1080p.mp4
With the first commit only: after Ctrl+Shift+4 to a restored tab, the footer's shortcuts button has the focus ring.
recording_20261030_034625_1080p.mp4
How to test
Expected result: after steps 2 and 4 the cursor moves in the listing without clicking a column or pressing Tab. After step 5 focus is back in the filter field.
Related issue
Closes #1929