Skip to content

Make active document and pane tabs easier to identify - #18734

Merged
kevinushey merged 5 commits into
mainfrom
feature/18692-active-tab-indicator
Sep 8, 2026
Merged

kevinushey merged 5 commits into
mainfrom
feature/18692-active-tab-indicator

Conversation

@kevinushey

@kevinushey kevinushey commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Intent

Make the active document or pane tab easier to identify when its background is only subtly different from neighboring tabs. Highlighting is enabled by default; users can turn it off with Highlight active document and pane tabs in Global Options > General > Basic > Other. Closes #18692.

Active document and pane tab highlighting

The preview illustrates the highlighting. The current implementation uses a 2px overline and preserves tab widths when the selection changes.

Approach

Selected tabs have a 2px blue inset overline and a heavier label. A subtle 0.4px text stroke adds emphasis without changing font metrics, so switching tabs preserves tab widths and filename truncation. Dark themes use a lighter blue overline with an explicitly more specific selector. Minimized pane strips keep their previous label styling because they have no selected-tab indicator. The rules add no height or padding and use the existing theme hooks without !important.

The new highlight_active_tabs user preference defaults to true and controls the highlighting through a body CSS class. Applying a change updates the tabs immediately, and the choice persists across reloads. Disabling it restores the previous tab styling. The preference handler runs in the main window and satellites.

Automated Tests

  • 11 targeted Playwright tests passed on macOS Desktop: five preference/style tests in the final run and six existing tab layout and active-tab restoration tests. Retries were disabled.
  • Coverage verifies the default, Cancel, Apply, persistence after reload, stable tab widths and filename truncation, and selection/toggle behavior in Modern light, Modern dark (Cobalt), and Sky themes. Minimized-pane styling is checked with highlighting both enabled and disabled in each theme.
  • Java compilation and GWT draft compilation/linking passed.
  • Playwright TypeScript type checking and git diff --check passed.
  • The generated C++ preference accessor passed a syntax check when the preference was added; it is unchanged by the styling follow-up.

Desktop tests used this worktree's rebuilt frontend and updated preference schema with the existing local C++ session binary. A full native rebuild was not performed.

QA Notes

Visually checked the selected labels and overlines in Modern light, Modern dark, and Sky. Checked the checkbox's placement under General > Basic > Other.

To verify, open several documents, including a long filename, and switch both document and pane tabs. The selected label should look heavier without moving neighboring tabs or changing filename truncation. Minimize a pane and confirm its labels retain their previous styling. Uncheck the preference and click Apply: the overlines and added text emphasis should disappear. Reload RStudio and confirm the setting remains off, then re-enable it.

Documentation

Updated NEWS.md with a linked issue reference, a description of the visual change, and where to disable it.

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

1 test(s) failed

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

Passed Failed Skipped Flaky
2674 1 193 3
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 2 0 10 0
❌ desktop-linux 674 1 38 0
✅ desktop-macos 671 0 42 1
✅ desktop-windows 678 0 39 2
✅ server-linux 621 0 44 0
✅ 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 7a5661c5cbc52d77c955c69595221d2a00503af7 - Run #878

@gtritchie gtritchie added this to the 2026.10 (Blue Mistflower) milestone Sep 8, 2026

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No blocking issues. 2 follow-up, 4 nits (2 commented inline, 2 counted below)

🟠 is real but not merge-blocking — either address it here or open an issue to do so later. 🟡 is optional.

  • 🟠 src/gwt/.../prefs/model/UserPrefs.java:97 — satellite windows never get the highlight body class at startup
  • 🟠 themeStyles.css:1450 — minimized pane tab strip de-bolds and gains no indicator
  • 🟡 NEWS.md:5 — entry doesn't use the linked-issue prefix format
  • 🟡 themeStyles.css:2512 — dark override wins on source order rather than specificity

Nits not commented inline

  • themeStyles.css:2509 — #3465a4 is a new accent blue that appears nowhere else in this stylesheet; the accent used elsewhere is #75AADB (line 3275). A later accent change will miss this one.
  • themeStyles.css:2517 — making label weight depend on selection changes each tab's rendered width, so the strip shifts horizontally on every switch, and filenames near the 200px .docTabLabel max-width gain an ellipsis only while selected.

Checked and clear

All six generate-prefs.R outputs are present and consistent (UserPrefValues.hpp/.cpp, SessionUserPrefValues.R, UserPrefsAccessor.java, UserPrefsAccessorConstants.java, _en.properties). The font-weight: 600 rule out-specifies both .docTabPanel.moduleTabPanel (line 1344) and the dark 400 rule (line 1454), so bold still wins for the selected tab in every theme; the dark 400 rule and the new normal rule tie on specificity but resolve to the same weight. Doc and pane tab labels are both single real .gwt-Label elements inside table.rstheme_tabLayoutCenter — the dirty marker uses setStyleName, which drops gwt-Label, so the test's .gwt-Label locators can't hit strict-mode violations. The per-theme -selected rules at 2978/3033/3108 set only background, so there's no box-shadow conflict; dialog tab panels don't use rstheme_tabLayoutCenter and are unaffected; and the rgb(...) escaping in the test's accent regex is correct.

eventBus.addHandler(DeferredInitCompletedEvent.TYPE, this);

// Satellites receive the same preference updates as the main window.
highlightActiveTabs().addValueChangeHandler(event -> syncHighlightActiveTabs());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🟠 Satellite windows never get rstudio-highlight-active-tabs at startup, so a popped-out source window shows no highlight until the preference is toggled.

Suggested change
highlightActiveTabs().addValueChangeHandler(event -> syncHighlightActiveTabs());
highlightActiveTabs().bind(enabled -> syncHighlightActiveTabs());
Why

syncHighlightActiveTabs() is otherwise reached only from onSessionInit, and that handler doesn't run in satellites.

Satellite.setSessionInfo() (Satellite.java:245-259) fires SessionInitEvent and only afterwards calls pUIPrefs_.get() — that line exists precisely because prefs aren't constructed yet. Nothing else on the satellite startup path builds them first: SatelliteApplication holds pUserPrefs_ as a @SuppressWarnings("unused") Provider it never calls, AddinsCommandManager (the one thing constructed before the fire) doesn't inject prefs, and pAceThemes_.get() runs after satellite_.initialize(...).

So UserPrefs is first constructed by SatelliteWindow's own SessionInitEvent handler, mid-dispatch. EventBus extends HandlerManager, which defers handler additions made while firing, so the UserPrefs.onSessionInit handler registered at that moment never sees the in-flight event.

Source satellites do render the tab strip (SourceSatelliteWindow.onInitialize calls pSource_.get().loadDisplay() → SourcePane → DocTabLayoutPanel), so the effect is visible: pop a document out and its tabs are unstyled. bind() adds the same value-change handler and also applies the current value immediately — at satellite construction time session info is already set, so it reads correctly there, and onSessionInit still covers the main window, where construction predates client_init.

Not merge-blocking: it's cosmetic, and toggling the preference repairs the window.

padding-top: 4px;
}

.rstudio-highlight-active-tabs .moduleTabPanel .gwt-TabLayoutPanelTab .gwt-Label {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🟠 This also de-bolds minimized pane tab strips, which get neither the bold label nor the overline, so they just lose the bold they had.

Either mark the selected tab in MinimizedModuleTabLayoutPanel.setTabs() too, or exclude .minimized from this rule.

Why

MinimizedModuleTabLayoutPanel.setTabs() (MinimizedModuleTabLayoutPanel.java:59) adds only gwt-TabLayoutPanelTab to each ModuleTab — never gwt-TabLayoutPanelTab-selected — and the strip is a plain HorizontalPanel added as the frame's extra widget, so it sits outside any .gwt-TabLayoutPanelTabs container.

Both new rules therefore miss it: the font-weight: 600 and light box-shadow rules need the .gwt-TabLayoutPanelTabs ancestor, and all three need -selected. This rule does apply, and the panel carries moduleTabPanel. With the preference on (the default), minimizing the Files/Plots/Packages/Help pane renders every label in the strip at regular weight where it was previously bold, with nothing marking the selected pane.

Not merge-blocking: purely visual, and that strip had no selection indicator before this change either.

Comment thread NEWS.md Outdated

### New
- Optimized RStudio Desktop startup time.
- Active document and pane tabs now have a bold label and a blue overline to make them easier to identify. This is enabled by default and can be disabled in Global Options > General > Basic > Other. (#18692)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🟡 The trailing bare (#18692) renders as plain text, so the entry has no link to the issue.

Suggested change
- Active document and pane tabs now have a bold label and a blue overline to make them easier to identify. This is enabled by default and can be disabled in Global Options > General > Basic > Other. (#18692)
- ([#18692](https://github.com/rstudio/rstudio/issues/18692)): Active document and pane tabs now have a bold label and a blue overline to make them easier to identify. This is enabled by default and can be disabled in Global Options > General > Basic > Other.
Why

Every other entry in NEWS.md leads with a linked issue reference in the - ([#NNNN](url)): form — see lines 7-10 in the ### Fixed section.

box-shadow: 0 2px 0 #3465a4 inset;
}

.rstudio-highlight-active-tabs .rstudio-themes-dark .gwt-TabLayoutPanelTab-selected table.rstheme_tabLayoutCenter {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🟡 This override ties the light rule on specificity, so it wins only because it appears four lines later.

Suggested change
.rstudio-highlight-active-tabs .rstudio-themes-dark .gwt-TabLayoutPanelTab-selected table.rstheme_tabLayoutCenter {
.rstudio-highlight-active-tabs .rstudio-themes-dark .gwt-TabLayoutPanelTabs .gwt-TabLayoutPanelTab-selected table.rstheme_tabLayoutCenter {
Why

Both selectors weigh in at four classes plus one element. Reordering this block later, or a user rstheme that re-declares the light selector after these rules, would silently restore the dark navy #3465a4 overline on dark tab backgrounds. Inserting .gwt-TabLayoutPanelTabs after .rstudio-themes-dark (the theme class lands on #rstudio_container, an ancestor of the tab strip) makes the override win on specificity and match exactly the element set it is overriding.

@gtritchie gtritchie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Feedback posted

@kevinushey
kevinushey merged commit eb363ed into main Sep 8, 2026
4 of 8 checks passed
@kevinushey
kevinushey deleted the feature/18692-active-tab-indicator branch September 8, 2026 23:51
kevinushey added a commit that referenced this pull request Sep 12, 2026
)

* highlight only the active document tab, including its top border

Follow-up to #18734. Pane tabs keep their previous styling; the selected
document tab's overline now recolors the tab's own top border and extends
it one pixel inward, so it reads as a single 2px bar that follows the
rounded corners.

Addresses #18692

* draw the active tab indicator as a flat bar over the pane frame border

The pane frame paints a 1px border across the top row of the tab strip,
which covered the tab's recolored top border. Draw the indicator as a
raised 2px ::before overlay on the selected document tab instead, and
keep a 1px inset shadow so the bar flows into the tab's rounded corners.

* draw the active tab indicator's end curves by hand

An inset box-shadow is painted inside the border box while the flat bar
fills it, so the two could never meet at the tab's rounded corners. Shape
the overlay like the top of the tab instead: same 3px radius, 2px top
border, 1px side borders, all in the accent color.

* extend the active tab indicator 1px upward

The overlay now starts 1px above the tab with a 3px top edge; its radius
grows by 1px so the outer curves stay concentric with the tab's corners.

* anchor the active tab indicator so it escapes the tab strip clipping

The tab strip sits 1px above its GWT layout layer, which clips it, so the
tab's top row (where the pane frame's border paints) was never visible
and the in-flow overlay could not extend upward. Position the overlay
with CSS anchor positioning as a fixed box glued to the tab instead; the
in-flow version remains as the fallback where anchors are unsupported.

* use a more saturated accent for the dark theme tab indicator

#8ab4f8 is nearly as light as the tab label and read as a highlight
rather than an accent; #4f8fea matches the light theme's saturation.

* darken the dark theme tab indicator slightly

* scope anchored tab indicator rules to docTabPanel

* drop unused accent argument from disabled-state highlight checks

* clip the tab indicator while the selected tab is partly scrolled out of view

* fix active tab preference test after reload

This branch was previously deployed

1 inactive deployment
e2e-playwright — 7a5661c5 Deployed Sep 9, 2026 by kevinushey via windows / e2e-desktop-windows (4) #878
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.

Feature request: make the active editor tab visually distinct

2 participants