Repository navigation
Keep a side list's walked tab in the window so the next arrow still walks - #6034
Merged
Merged
Conversation
…alks A side tab list that isn't given a height to fill scrolls with the page, and it can be taller than the window. The tab walk focused each tab without scrolling and showed it only within the strip, assuming the strip is always on screen. So ArrowDown landed on the first tab entirely below the window with the page unmoved. The next key found focus on a control out of sight and released it (keyboard/controller.js), so focus fell to the body and no tab opened. In a 1440x900 window that was the 24th tab to the 25th; in a 1280x600 window, the 16th to the 17th. Home, End, ArrowUp and wrapping failed the same way. After the switch, the walk now calls #showTab again without the strip bound, after the focus paint, as rowWalk does. A stuck strip's tab is already in the window, so nothing scrolls there. The strip bound stays for arrival, history, travel and resize, which must not scroll the page. Where it fits, the walked tab arrives together with its group's label, as it already did in a list that scrolls on its own. Probed on base and head in Chromium and Firefox. A side list now keeps focus on every walked tab, and the page scrolls along. A boxed top strip under a scrolled page, the page's own layout-flow strip and a side list narrowed to a row keep the same focus and page scrollTop at every press. The new browser test walks 16 tabs in a 500px-tall window, down round the end and up round the start. It fails on main in both engines.
tests/AGENTS.md asks a browser test to reach a control by Tab or a click rather than element.focus(). The walk itself is unchanged.
max-sixty
marked this pull request as ready for review
November 15, 2026 09:32
leaf-agent
approved these changes
Nov 15, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 15, 2026
…er scrolls the item away (#6057) Max chose this look on 2026-11-15 ("Keep the list beside the item"), from before/after stills at 1440×900 and phone width. What changes on screen: - At the top of the page nothing changes: the test pages draw the same pixels as on main. - Walked or scrolled down a long list, the frame is as tall as the item, or the window's band where the item is shorter, rather than as tall as the list. The list scrolls inside it with no scrollbar, as a workspace's list already does. A walked tab keeps a row showing on either side of it. - Beside an item taller than the window, the list, short or long, follows the reader down the item instead of scrolling away above it. - A phone's row and a full-height workspace's queue are unchanged, apart from the row's `aria-orientation`. A side list (`lf-tabs list="side"`) given no height to fill ran its column with the page. On Max's 30-document page (the #4781 repro) the column was taller than the window. A walk down it scrolled the page to each tab and carried the open item's start off screen. A tab the user then read away from was left off screen, so the next arrow let go of it (keyboard/controller.js) and focus fell to the page. #6034 scrolled the walked tab into the window, which fixed the first drop at tab 25 but not these. The column's list now sticks in the window beside the item and scrolls on its own (packages/default/styles/tabs.css). It sticks one landing room below the sticky-header slot and ends one landing room above the floating panel's row. That is the band the root lands things in, as a column's sidebar sticks, so landing a tab in the list moves no page. The list is as tall as its rows up to that band and scrolls inside it beyond that. It stands at the top of its cell, so a short list sticks until its item ends. It keeps a tab's room (`--lf-tab-row-h`, the height a tab in the narrow row already reserved) above and below a tab it lands, so the rows either side of the open one show and the list doesn't look as though it starts or ends there. The column's tint and rule move from the list to the set's `::before`, which spans every row of the set, so the column reads as one from the frame's top to its foot while the list over it sticks. A wheel at either end of the list goes on to scroll the page. A full-height workspace's list and the row a narrow window stacks the list into are unchanged. lf-tabs.js follows the layout: - The list is a reading region whenever the theme says it holds its own height (`--lf-holds-height`), not only in a full-height workspace. - A switch made while the list sticks opens the new item at its start, as a boxed set's switch does once its strip sticks. Read down one item, press ArrowDown, and the next opens at its top. - The tablist's `aria-orientation` follows the way its names run. A side list narrowed to a row was still marked vertical. ## Evidence `leaf-dev probe PAGE --viewport 1440x900 --journey WALK --base`, in Chromium and Firefox, which agree. PAGE is a column page whose body is a side list of 30 documents. LONG gives each item prose above its document, so the item is taller than the window. MAX holds only the document, as #4781's page did. WALK presses ArrowDown from the first tab to the last and ArrowUp back, then reads an item in three ways and presses ArrowDown. | | base | head | | --- | --- | --- | | open item's top at tab 25, LONG / MAX | −636 / −146 px | 88 / 69 px | | open item's top at the last tab, LONG / MAX | −856 / −291 px | ≥ 20 px | | focus lost on the walk down and back up | never | never | | tab 25, scroll back up until its item's top stands 20 px below the window's top, ArrowDown | focus to the page | tab 26 opens | | LONG item 10 read 900 px down, ArrowDown | focus to the page | tab 11 opens at its top | | item 0 read to its end, ArrowDown | focus to the page | tab 1 opens at its top | | walking up from the last tab to tab 15: the row above the open tab | shows (the list runs with the page) | shows, whole | | five-tab list, its item read to its end | list scrolled 567 px above the window | list stuck at the window's top | alert-review's workspace queue (stills `side-tab-focus`, `alert-queue-tally`) draws the same pixels as on main. The `::before` keeps `grid-row: 1 / -1`: a full-height workspace's grid has two rows, and with the ground in the first alone that queue lost its column's tint (836,560 px differ). ## Still open, on base and head alike Each of these leaves focus on a tab that is off screen, and the next arrow lets go of it: - Scrolled past the frame's end, so what follows the set shows below it, the list leaves with the frame like any sticky box, and a tab near its top goes off screen. - Scrolled back to the page's top, the list stands where the page puts it and runs about 77 px past the window's foot, so a tab walked into that part is off screen. - Wheeling the list itself until the focused tab scrolls out of it. Extending `focusPlace` (user-place.js) so that a tab scrolled out of a side list that is itself still on screen keeps focus would fix the last two. That amends the let-go rule Max chose on 2026-11-04, so it is his call; this PR doesn't build it. ## Tests `test_a_side_list_longer_than_the_window_keeps_its_tab_and_open_item_in_view` replaces #6034's walk test. It walks 30 tabs, as #4781's page held: down every tab and round, then back up through the middle of the list. At each step it holds the open item's start in the window and the row the walk heads for in view. Then it reads down an item before the next arrow, and reads a four-tab list's item to near its end with the list still beside it. On main it fails at the walk's first item-start check in both engines. With the room at the list's foot only, it fails walking up (tab 19 at a viewport ratio of 0.91); without `align-self: start`, at the four-tab list. `test_a_tab_strip_keeps_its_open_tab_in_its_one_row` checks the orientation either side of the narrowing, and the history test drops the page CSS that made its list stick, which the theme now does. Ran 69 tests by node id (every test building a side list, a page's parts or alert-review's queue, and all of `test_tabs.py`): all pass. `pnpm run check:browser`, pre-commit. Not verified: WebKit, dark scheme, touch at tablet width.
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.
Arrow keys in a side tab list (
lf-tabs list="side") now scroll the page when the next tab is below the bottom of the window or above its top. Before, the walk opened a tab off screen and left focus on it. The next key then dropped focus to the page and opened nothing.Cause
A side list that isn't given a height to fill doesn't scroll on its own. Its column scrolls with the page and can be taller than the window. The walk focuses each tab with
focusDestination(next, "move"), which never scrolls. The only reveal was#showTab, and it scrolls only within the strip (within: strip). The walk's comment assumed "the strip is always on screen". That holds for a sticky row and for a list that scrolls on its own, but not for this column.So the walk landed on the first tab entirely below the window with the page unmoved. On the next key, the keyboard controller found focus on a control out of sight and released it (
keyboard/controller.js,focusPlace). Focus went to the body, and the browser's default arrow scrolled the page by a line.Where it breaks depends on the window's height, not on how much the page holds. In a 1440×900 window the 24th tab was the first entirely below the window, so 24→25 failed. In a 1280×600 window, 16→17 failed. Home, End, ArrowUp and wrapping fail the same way whenever they land beyond the top or bottom of the window.
Fix
After the switch, the walk calls
#showTabagain with no bound, so the tab it focused comes into the window. That happens after the focus paint, as inrowWalkand Leaf's other walks.#showTabkeeps its strip bound for its other callers: arrival, history, travel to a passage inside a hidden panel, and a resize, none of which may scroll the page. A stuck strip's tab is already in the window, so the second call scrolls nothing there. Reusing#showTabmeans the walk shows the same thing the strip does: where it fits, the tab arrives together with its group's label. Walking up into a group of a long side list now shows the whole label instead of leaving it cut at the top of the window.Evidence
uv run leaf-dev probe PAGE --journey WALK --base, in Chromium and Firefox at 1440×900. PAGE is a side list of 30 one-line tabs. WALK is a scratch journey that focuses the first tab, presses ArrowDown 29 times, and after each press reads the focused tab, the open panel, whether the tab is entirely in the window, and the page'sscrollTop:t0 … t23 body body …. The open tab stays t23, and each later press scrolls the page by the browser's arrow step.t0 … t29. Every tab is entirely in the window, and the page scrolls along.Home, End, ArrowUp, ArrowLeft and wrapping at both ends: on head, every press lands on the expected tab, and it is in the window. On base, focus is lost from the first press that lands off screen.
Unchanged between base and head, in both engines, with the same focus and the same page
scrollTopat every press:layout-flowtab strip, switching viewsEach strip was walked through all its tabs with ArrowRight, then ArrowLeft, End and Home.
Tests
tests/browser/widgets/test_tabs.py::test_a_walk_down_a_side_list_longer_than_the_window_keeps_each_tab_in_view, in Chromium and Firefox, uses 16 tabs in a 1200×500 window. It presses ArrowDown through every tab and round to the first, then ArrowUp round to the last and once more. It fails on main in both engines and passes with the fix.Also ran, by node id, every test that presses an arrow, Home or End where a tab strip is in play: 43 passed. That covers
tests/browser/widgets/test_tabs.py,tests/browser/navigation/test_tabs.py,controls/test_focus.py,controls/test_rings.py,widgets/test_code_and_documents.pyand two side-list journeys.pnpm run check:browserpasses.Not verified
WebKit. Touch input doesn't take this route.