Skip to content

Make panes hidden by zoom inert - #19182

Merged
gtritchie merged 20 commits into
mainfrom
bugfix/zoom-hidden-panes-inert
Oct 20, 2026
Merged

gtritchie merged 20 commits into
mainfrom
bugfix/zoom-hidden-panes-inert

Conversation

@gtritchie

@gtritchie gtritchie commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Fixes #19181.

A column collapsed by a zoom command, or dragged shut with a column splitter, stayed in the accessibility tree and the Tab order. Its panes are now inert.

Inert columns

MainSplitPanel marks a column's layout container inert (with aria-hidden) while the column is narrower than 20px, and clears it once the column widens. It checks after every layout pass and at the end of every animated resize. That covers:

  • the column zooms (left/center, right, sidebar)
  • pane zooms such as Zoom Console or Zoom Files
  • splitter drags, by mouse or keyboard
  • window resizes

Splitters sit outside the containers, so they stay reachable.

Quadrants needed no change: a maximized pane's sibling, or a quadrant snapped shut with the row splitter, is already display:none.

Focus

When a zoom, splitter drag or window resize hides the element that has focus, the browser would drop focus to the page body. PaneManager instead moves it to a pane that is still showing:

  • A pane zoom, or zooming another tab of the zoomed pane, focuses the zoomed pane.
  • When a layout pass makes the column holding focus inert (a column zoom, a mouse drag of a splitter, a window shrink), MainSplitPanel reports it, and focus goes to the topmost visible pane with a tab in the widest column, falling back to the topmost visible pane.
  • Within the pane, focus goes to the selected tab without changing which tab is selected, so a Console pane showing Terminal keeps Terminal.
  • A pane with no tabs, such as an empty sidebar, gets its first control (Configure Panes), then its frame buttons.

Focus is left alone when the focused element stays visible, or when something else moved focus during the zoom.

Tests

e2e/rstudio/tests/panes/layout/zoom_inert.test.ts covers the accessibility tree and inert state for:

  • column, pane and sidebar zooms
  • mouse and keyboard splitter drags
  • quadrant maximize and splitter snap

It also covers focus after zooms that hide the focused pane, quadrant, or tab, after a mouse drag or window shrink that shuts the focused column, and after zooming another tab of a zoomed pane. panes.test.ts adds the empty-sidebar and empty-tabset focus cases, which need the Pane Layout dialog.

Focus a tabbed pane's selected tab directly instead of through
focusWindow(), which assumes a selected tab. Restore the column splitter
after the splitter test, and cover zooming a tab from a sibling tab.

Addresses #19181.
A sidebar with no tabs is the default when Posit Assistant is off.
Zooming it from the Console left focus on the page body; focus the
empty state's first control instead.

Addresses #19181.
An emptied tabset can be reopened from its minimized bar with no tab to
focus. A column zoom now moves focus to a pane in the zoomed column that
has a tab, falling back to the topmost one. The focus tests now set up
Console focus with focusConsole(), which retries when focus is stolen.

Addresses #19181.
Uncheck whichever tabs the Pane Layout dialog shows rather than naming
Posit Assistant, whose checkbox is hidden when the server disables it,
and run setup inside the cleanup block.

Addresses #19181.
With every tab moved out of the right column, TabSet1 stays open with no
tab or empty state, so a column zoom from the Console left focus on the
page body. Focus the pane's first frame button instead.

Addresses #19181.
updateCollapsedColumns runs on every layout pass, splitter drags
included, so skip columns whose state is already correct.

Addresses #19181.
focusPane sent the Console pane through focusWindow, which always runs
activateConsole and so switched a pane showing Terminal or Background
Jobs back to its Console tab. Focus the selected tab instead, or the
console itself when it has no tab bar. Also look up the column zoom's
focus target only when the zoom hid focus, and wrap two long lines.

Addresses #19181.
TerminalPane.setFocus() is a no-op: the terminal focuses itself only
when its tab is selected. A column zoom that moved focus into a Console
pane showing Terminal left it on the page body. Fall back to the pane's
first control, the selected tab. The test now waits for the shell to
start, which the previous version raced, and kills it afterwards.

Addresses #19181.
@gtritchie

Copy link
Copy Markdown
Member Author

Code review findings

Actionable items from an automated review of 84c75ba. Each finding is marked new (introduced by this PR) or pre-existing.

Important

  1. New. src/gwt/src/org/rstudio/studio/client/workbench/ui/MainSplitPanel.java:693: a column becomes inert on any layout pass, but focus is only moved back on the two zoom paths in PaneManager. The GWT fork's SplitLayoutPanel.Splitter calls preventDefault() on mousedown, so a mouse drag leaves focus inside the column it shuts. Example: focus the Files list and drag the middle column splitter to the right edge. The right column goes inert and focus drops to <body>. Before this PR, focus stayed on the hidden 0px element. A window resize that narrows a focused column below 20px does the same. Fix: when updateCollapsedColumns makes a container inert that contains document.activeElement, move focus out (for example, to the widest remaining column).

  2. Pre-existing. src/gwt/src/org/rstudio/studio/client/workbench/ui/PaneManager.java:1436-1438: with a pane already zoomed, zooming another tab in the same pane goes through this branch (maximizedTab_ = tab; activateTab(tab)). The branch never calls zoomHidFocus/focusPane. Example: Zoom Files, focus the Files list, then Zoom Plots. Focus drops to <body>. The reverse order (Plots focused, Zoom Files, nothing zoomed yet) does recover and is tested, so the two orders now behave differently. This could be a follow-up.

  3. New. e2e/rstudio/tests/panes/layout/zoom_inert.test.ts:129: the splitter-drag test checks inert state but never where focus ends up. The PR description lists window resizes as covered, but no test changes the viewport. The zoomed-pane tab switch in finding 2 has no test either.

Suggestions

  1. New (around existing literals). src/gwt/src/org/rstudio/studio/client/workbench/ui/MainSplitPanel.java:787 and :796: the comment on COLLAPSED_COLUMN_WIDTH says isZoomedColumnState uses the same cutoff, but it still hard-codes < 20 in both places. Fix: use the constant there.

  2. New. src/gwt/src/org/rstudio/core/client/dom/DomUtils.java:86: hasLayoutBox sits beside the existing DomUtils.isEffectivelyVisible(Element) (line 162) and does nearly the same job. The quadrant and tab hides here use inline display:none, which isEffectivelyVisible already detects. Fix: use the existing helper, or say in both doc comments when to use which.

  3. New. src/gwt/src/org/rstudio/studio/client/workbench/ui/MainSplitPanel.java:702: getColumns() builds two ArrayLists on every onResize, which includes every mouse move during a splitter drag. Minor. Fix: iterate the panel's children and skip the splitters.

Every hide a zoom applies is either an inert column or an inline
display:none, which the existing helper already detects, so the new
hasLayoutBox helper is dropped.

Addresses #19181.
A mouse drag of a splitter, or a window shrink, can collapse the column
that holds focus; the splitter takes no focus on mousedown. Once the
column is inert the browser drops focus to the page body. MainSplitPanel
now reports such a collapse, and PaneManager focuses the widest column.
That also covers column zooms, so zoomColumn() no longer needs its own
rescue.

Addresses #19181.
With a pane zoomed, zooming another of its tabs only switches tabs, and
the switch hid the focused content without moving focus anywhere.

Addresses #19181.
@gtritchie

Copy link
Copy Markdown
Member Author

Addressed in 75759bb..92944df:

  1. Fixed in fece3fc. MainSplitPanel reports when a layout pass makes the column holding focus inert, and PaneManager moves focus into the widest column. This also covers column zooms, so zoomColumn() no longer has its own rescue.
  2. Fixed in 7d4a399. The tab panel hides the old tab in a later layout pass, so the check runs deferred.
  3. Added focus assertions to the mouse-drag test, a window-shrink test (columns keep their share of the window, so it shrinks past a column already dragged narrow), and a test for finding 2. Each fails without its fix.
  4. Fixed in 75759bb.
  5. Fixed in 85b3544. hasLayoutBox is removed and isEffectivelyVisible is used instead.
  6. SplitLayoutPanel.Splitter is package-private in the GWT fork, so MainSplitPanel can't skip splitters by type. aeb6197 instead checks each column field directly, with no lists built per layout pass.

A window resize first lays out the old column sizes at the new width,
which can briefly squeeze the fill column shut. Marking it inert then
dropped its focus, or moved focus to another column, though the deferred
proportional layout reopened it.

Addresses #19181.
@gtritchie

Copy link
Copy Markdown
Member Author

Follow-up to the earlier reply: 139d4d4 fixes a race in the focus move for finding 1.

On a window resize, the layout first keeps each column's old width at the new window width, so the center column could drop below 20px for a moment, until a deferred layout applied the proportional widths. The column went inert in that window, and its focus was lost or moved to the right column even though the column then reopened. onResize() now skips the inert check while that proportional layout is pending. The pending layout comes back through onResize() with the final widths, and the check runs then.

A new test, "shrinking the window keeps focus in a narrow column that stays open", drags the center column narrow, focuses the Console, halves the window, and checks that focus stays in the Console. It fails without the fix.

The layout and terminal e2e suites pass (73 passed, 3 skipped).

@gtritchie

Copy link
Copy Markdown
Member Author

Re-review of 139d4d4

All six findings from the earlier review are addressed:

  1. Focus lost when a splitter drag or resize shuts the focused column. Fixed in fece3fc and 139d4d4. updateCollapsedColumn now reports when a layout pass makes the focused column inert, from any cause, and PaneManager moves focus into the widest column. On a pane zoom, onActivation places focus before that deferred rescue runs, so the rescue leaves it alone. Skipping the inert check while a proportional relayout is pending closes the resize race.
  2. Zooming another tab of the zoomed pane. Fixed in 7d4a399 by the deferred zoomHidFocus check after activateTab.
  3. Test coverage. Fixed. The mouse-drag test now asserts focus. Two window-shrink tests and a Zoom Files → Zoom Plots test are new.
  4. Literal 20 in isZoomedColumnState. Fixed in 75759bb.
  5. hasLayoutBox vs isEffectivelyVisible. Fixed in 85b3544.
  6. Per-layout-pass list building. Fixed in aeb6197. getWidestColumn still builds a list, but only when focus was hidden, which is fine.

I also reviewed the new code for regressions and found none. That includes adding sourceLogicalWindows_ to getFocusTargetIn: an extra source column always holds at least one document (SourceColumn.onBeforeShow fills an empty one, and closing the last document removes the column), so focusing it never creates a document.

This re-review covered the code only; I did not run the e2e suites.

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

#################### 100% pass rate

Passed Failed Skipped Flaky
3838 0 200 6
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 10 0
✅ desktop-linux 961 0 42 2
✅ desktop-macos 967 0 37 2
✅ desktop-windows 963 0 47 1
✅ server-linux 917 0 44 1
✅ setup 28 0 20 0
View / download the full report

View report online -- opens in the browser, no download needed. Available for 14 days.

Download playwright-report.zip -- extract and open index.html

Includes screenshots, traces, and step-by-step details for every test. Expires in 15 days.


All platforms - commit a565a23024bf0723407e57060ba95ad062c5f23e - Run #1558

@gtritchie
gtritchie merged commit 482c2a9 into main Oct 20, 2026
1 of 7 checks passed
@gtritchie
gtritchie deleted the bugfix/zoom-hidden-panes-inert branch October 20, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panes hidden by zoom commands remain reachable by screen readers and Tab

1 participant