Skip to content

Name a raised pane by its canonical name, not its title - #19300

Merged
gtritchie merged 10 commits into
mainfrom
bugfix/19234-pane-raise-canonical-name
Oct 27, 2026
Merged

gtritchie merged 10 commits into
mainfrom
bugfix/19234-pane-raise-canonical-name

Conversation

@gtritchie

@gtritchie gtritchie commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

When a pane raises itself, WorkbenchPane.bringToFront() fires an ActivatePaneEvent naming the pane, and a zoom of another pane moves to the tab that event selects. The event carried the pane's display title, which is localized ("Aide" for Help in French). PaneManager.tabForName() only knows the canonical names, so it dropped the event, and the moved zoom took whichever tab was activated before.

  • WorkbenchPane takes the pane's canonical name (PaneManager.HELP_PANE etc.) alongside its title, and names itself with it. Panes without an event bus use the one-argument constructor, as ConsolePane now does. TerminalPane passes no name, since PaneManager has no tab for it.
  • Entering the debugger activates Environment by ENVIRONMENT_PANE rather than its localized title.
  • Help no longer fires its own ActivatePaneEvent alongside a raise of HelpPane (the Help menu commands, a help topic), and Help Home no longer raises the pane before home() raises it, since the raise now names Help itself.

The English titles equal the canonical names except Chat ("Posit Assistant"), and nothing raises ChatPane, so English behavior is unchanged.

Tests: during a Console zoom, Help Home, Go To Working Directory, a new plot, a page in the Viewer, Clear Workspace and Clear History each move the zoom to their own tab; entering the debugger selects the Environment tab. With seven panes given a wrong canonical name, these tests fail; all pass on this branch, as does the existing French Search R Help test.

Fixes #19234.

A pane that raises itself during a zoom of another pane names itself in
an ActivatePaneEvent, and the zoom moves to the tab that event selects.
Only Help's raise was covered. Add Go To Working Directory, a new plot,
a page in the Viewer, Clear Workspace and Clear History during a Console
zoom, each checking that the zoom lands on its own tab, and check that
entering the debugger selects the Environment tab.

Addresses #19234
WorkbenchPane.bringToFront() fired ActivatePaneEvent with the pane's
display title, which is localized ("Aide" for Help in French).
PaneManager only knows the canonical names (HELP_PANE etc.), so it
dropped the event, and a zoom the raise moved took the previously
activated tab. WorkbenchPane now takes the canonical name alongside the
title and fires that. Entering the debugger named Environment by its
localized title the same way and now uses ENVIRONMENT_PANE.

The Help menu commands no longer fire Help's own ActivatePaneEvent
before raising HelpPane, since the raise now names Help itself.

The English titles equal the canonical names except Chat ("Posit
Assistant"), and ChatPane never raises itself, so English behavior is
unchanged.

Addresses #19234
Clear History is disabled while History shows search results or a
command's context, and an earlier test (history_a11y) can leave it in
either. The Clear History raise test now runs historyDismissResults
first, which returns it to the recent list from both.

Passes with history_a11y run before it in the same worker.

Addresses #19234
The Viewer raise test assigned `f` in the global environment and left
its page in the Viewer. It now runs in local() and clears the Viewer
afterwards. Also list the debugger-entry test in debugger_extras's
header.

Addresses #19234
@gtritchie gtritchie added this to the 2026.11 (Montauk Daisy) milestone Oct 27, 2026

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Five findings, three of them inline. One that doesn't fit inline:

Presentation2Pane still raises without naming itself (pre-existing, same class of bug). Presentation2.onPresentationPreview calls display_.activate() (Presentation2.java:140), which calls bringToFront() (Presentation2Pane.java:167). The pane uses the one-argument constructor (Presentation2Pane.java:65), so no ActivatePaneEvent fires. WorkbenchTabPanel passes EnsureVisible up (WorkbenchTabPanel.java:284) before it selects the tab (:286), so PaneManager moves the zoom with whatever lastSelectedTab_ holds (PaneManager.java:546). During a Console zoom that is Console: the quadrant holding Presentation gets maximized while Zoom Console stays checked. Giving the pane PaneManager.PRESENTATIONS_PANE and the event bus would fix it, or see the note on WorkbenchPane.java:108.

Help.onShowHelp activates Help twice (Help.java:187). HelpPane doesn't override bringToFront(), so view_.showHelp() (HelpPane.java:842) now fires ActivatePaneEvent(HELP_PANE) as it raises the pane. The presenter's bringToFront() after it (Help.java:190) fires the same event again. Before this PR, that call was the only one that named Help in a non-English UI; now it can go. (See also the inline note on onHelpHome.)

if (events_ != null && !StringUtil.isNullOrEmpty(title_))
events_.fireEvent(new ActivatePaneEvent(title_));
if (events_ != null && !StringUtil.isNullOrEmpty(paneName_))
events_.fireEvent(new ActivatePaneEvent(paneName_));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each subclass now has to pass a name that tabForName (PaneManager.java:3311) recognizes, and a pane that leaves it out or mistypes it fails silently: the zoom moves with a stale lastSelectedTab_ (Presentation2 today; see the review body). The EnsureVisible handler in WorkbenchTabPanel (WorkbenchTabPanel.java:279) already holds the raised WorkbenchTab, and PaneManager maps WorkbenchTab to Tab in wbTabToTab_ (PaneManager.java:3272). Reporting the raised tab through that path would cover every pane without a string per pane.

Moving tabPanel_.selectTab(widget) ahead of the upward fireEvent wouldn't be enough on its own: TabLayoutPanel.selectTab returns early when the tab is already selected, so no selection event would update lastSelectedTab_.

}
// Commands handled by Shim for activation from main menu context. These raise
// the pane itself, as a help topic does, so it can take over a zoom or reopen
// a shut column; bringToFront() only activates the tab.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "bringToFront() only activates the tab" means the presenter's Help.bringToFront(), but it sits directly above four calls to view_.bringToFront(), which does raise the pane. Writing "the presenter's bringToFront()" would remove the ambiguity.

// Commands handled by Shim for activation from main menu context. These raise
// the pane itself, as a help topic does, so it can take over a zoom or reopen
// a shut column; bringToFront() only activates the tab.
public void onHelpHome() { view_.bringToFront(); home(); }

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

home() goes through showHelp() to HelpPane.showHelp(), which already calls bringToFront() (HelpPane.java:845). So the leading view_.bringToFront() raises the pane a second time. This predates the PR (the old raise() did the same), but this line is being rewritten anyway.

WorkbenchServerOperations server)
{
super(constants_.terminalText(), events);
super(constants_.terminalText(), PaneManager.TERMINAL_PANE, events);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabForName has no TERMINAL_PANE case, so the ActivatePaneEvent this pane fires is always dropped. That's harmless: Terminal lives in the Console window, and a zoom that moves there is Console's either way. But it reads as if Terminal's raise selects a tab by name like the others. The one-argument constructor, as ConsolePane uses, would make that explicit.

HelpPane.showHelp() raises the pane, which now names it as Help. So
onShowHelp no longer fires Help's ActivatePaneEvent after it, and Help
Home no longer raises the pane before home() raises it again. The
comment above the Help commands now says it is the presenter's
bringToFront() that only activates the tab.

All tests under tests/panes/help and the Help and Console-zoom tests in
zoom_inert pass (17 passed).

Addresses #19234
PaneManager has no tab for Terminal, so the TERMINAL_PANE name it fired
was always dropped, as its "Terminal" title was before. Pass null so the
pane fires no ActivatePaneEvent, which says so. It keeps the event bus,
which it uses for its own handlers.

Addresses #19234
The History tab's shim forwards only Load and Save History, so Clear
History has no handler until the History pane has loaded. The test only
passed when an earlier test in the run (history()) had loaded it; run
on its own, the command did nothing and no confirmation appeared. It now
activates History first, then reselects Environment so the raise still
has to select History.

Passes run alone with the other raise tests, twice.

Addresses #19234
Help Home now relies on home() to raise the Help pane, so check that it
moves a Console zoom to Help like the other pane raises.

Addresses #19234
History is delay-loaded, so activateHistory can return before the
History presenter has bound its command handlers, and the commands that
follow would do nothing. The Clear History test now waits for the
pane's Console History list, which renders only once the presenter
exists, before running historyDismissResults and clearHistory. It waits
for the list to be attached rather than visible, since an earlier test
can leave History showing search results.

Passes alone and after history_a11y in the same worker.

Addresses #19234
@gtritchie
gtritchie merged commit 096da7b into main Oct 27, 2026
11 checks passed
@gtritchie
gtritchie deleted the bugfix/19234-pane-raise-canonical-name branch October 27, 2026 20:19
@github-actions

Copy link
Copy Markdown

RStudio E2E - all platforms

4 test(s) failed

###################- 99% pass rate

Passed Failed Skipped Flaky
4531 4 239 1
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 4 0 16 0
❌ desktop-linux 1136 1 43 0
❌ desktop-macos 1133 1 47 0
❌ desktop-windows 1134 1 50 1
❌ server-linux 1076 1 51 0
✅ setup 48 0 32 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 0e962afde55331c4896e366514609b93b49104ee - Run #1771

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pane raises during a zoom use the localized pane title, which PaneManager doesn't recognize

1 participant