Skip to content

dark theme support for modal dialogs - #17242

Merged
kevinushey merged 60 commits into
mainfrom
feature/dark-theme-preferences-dialogs
Mar 19, 2026
Merged

kevinushey merged 60 commits into
mainfrom
feature/dark-theme-preferences-dialogs

Conversation

@kevinushey

@kevinushey kevinushey commented Mar 19, 2026 •

Copy link
Copy Markdown
Collaborator

Addresses #10296

Summary

  • Modal dialogs (Global Options, Project Options, message dialogs, etc.) now support dark theme styling when a dark editor theme is active
  • Added use_dark_theme_modal_dialogs user preference (defaults to true) to control the behavior
  • Dialogs respond to editor theme changes in real-time
  • Modernized the SlideLabel widget, replacing legacy PNG-based styling with CSS
  • Added dark theme styling for WidgetListBox, CheckBoxList, InfoBar, SectionChooser, SmallButton, and keyboard shortcut badges
  • Unified dialog control background color for buttons, inputs, and selects

Test plan

  • Enable a dark editor theme (e.g. Cobalt, Tomorrow Night) and open Global Options -- verify all panes display with dark styling
  • Open Project Options and verify dark styling applies to all panes including Version Control, Build Tools, and Project Assistant
  • Switch editor theme while a dialog is open -- verify the dialog updates in real-time
  • Set use_dark_theme_modal_dialogs to false and verify dialogs remain light even with a dark editor theme
  • Verify the SlideLabel progress indicator displays correctly in both light and dark themes
  • Verify message dialogs, text entry dialogs, and code search dialogs all support dark theme
  • Verify the Publishing Accounts list and Accessibility Announcements list display correctly in dark theme

@kevinushey kevinushey added this to the Globemaster Allium milestone Mar 19, 2026
@posit-snyk-bot

posit-snyk-bot commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

gtritchie

This comment was marked as resolved.

gtritchie

This comment was marked as resolved.

@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.

Code Review

Critical Issues (1)

1. TextEntryModalDialog.onLoad() uses fragile DOM index-based selector

TextEntryModalDialog.java — The new onLoad() locates the content cell via getElementsByTagName("td").getItem(1) with a getClassName().contains("dialogContent") check. This depends on ModalDialogBase's internal table layout order and uses a substring match rather than a proper class list check.

Element contentEl = getElement().getElementsByTagName("td").getItem(1);
if (contentEl != null && contentEl.getClassName().contains("dialogContent"))

Suggested fix — use a CSS rule instead of Java DOM traversal:

.rstudio-theme-aware-dialog td.dialogContent {
   padding-left: 14px;
   padding-right: 14px;
}

This eliminates the fragile positional index and inline styles entirely.


Important Issues (4)

2. PanmirrorDialogsStyles.css dark theme selectors missing .rstudio-theme-aware-dialog

The new rules at the bottom of PanmirrorDialogsStyles.css use .rstudio-themes-dark .dialog .infoLabel without the .rstudio-theme-aware-dialog qualifier. Every other CSS file in this PR uses .rstudio-themes-dark.rstudio-theme-aware-dialog to scope dark styling to opt-in dialogs only. Without the qualifier, these rules apply globally whenever the RStudio container has the dark theme class.

Fix: Change to .rstudio-themes-dark.rstudio-theme-aware-dialog .dialog .infoLabel (and .inlineInfoLabel, .heightAuto).

3. Spinner.java lacks ARIA accessibility attributes

The new Spinner widget is a bare <div> with CSS animation. The old progress_gray image it replaces had setAlt("Spinner") in SlideLabel.java. The new Spinner has no ARIA role or label for screen readers.

Fix: In the Spinner() constructor, either add Roles.getProgressbarRole().set(getElement()) with an aria-label, or if the spinner is always accompanied by visible text, set aria-hidden="true".

4. syncDarkThemeClass() has no null guard for userPrefs_

ModalDialogBase.java — While GIN injection is synchronous, UserPrefs has deep dependencies (Session, EventBus, server ops, etc.). If any dialog is constructed during very early startup before the GIN module finishes binding (e.g., LoggedOutDialog), userPrefs_ will be null and syncDarkThemeClass() will NPE. The EditorThemeChangedEvent handler registered in onLoad() also calls this method.

Fix: Add a null guard that defaults to the old DOM-only behavior:

boolean useDark = userPrefs_ != null && userPrefs_.useDarkThemeModalDialogs().getValue();

5. SavePlotAsImageDialog — unused globalDisplay_ field

The refactoring that moves file path selection to the native save dialog removes the validation code that used globalDisplay_, but the field is still declared as a member variable. This is dead code.

Fix: Remove the unused globalDisplay_ field and its constructor parameter assignment.


Suggestions (3)

6. Consider defaulting themeAware_ to true — The PR adds setThemeAware(true) to ~74 dialog constructors. If the vast majority of dialogs should be theme-aware, consider flipping the default and only calling setThemeAware(false) on the few exceptions. This would eliminate ~74 lines of mechanical changes and reduce the number of touched files significantly.

7. ConsolePreferencesPane duplicates wrapWithPanel() logic — This pane manually builds a DialogTabLayoutPanel with hidden tabs, which is exactly what the new wrapWithPanel() helper encapsulates. Other panes use the helper. Consider refactoring to wrapWithPanel("console_prefs") for consistency, or adding a comment explaining why manual construction is needed.

8. CSS @external/@eval duplication — The same @external rstudio-themes-dark + @eval THEME_DARKGREY_* blocks repeat across ~27 CSS files. This is partly a GWT limitation, but consolidating dialog dark-theme rules into themeStyles.css (which already has many) or a dedicated shared CSS file would make future color tweaks a single-file change.


Strengths

  • Architecture is sound — CSS class-based theming with .rstudio-themes-dark.rstudio-theme-aware-dialog provides clean opt-in scoping
  • Handler lifecycle is correct — EditorThemeChangedEvent registered in onLoad(), removed in onUnload(), preventing memory leaks
  • SlideLabel modernization is excellent — replacing 6 PNGs with CSS border-radius + box-shadow
  • DirectoryContentsWidget Timer pattern is well-done — proper cleanup in onDetach(), pointerEvents blocking, handles both early-arrival and timer-fired paths
  • CheckForUpdatesDialog error handling improved — now shows errors to users via indicator_.onError() instead of silently logging
  • User preference plumbing is complete end-to-end (schema → C++ → R → GWT)

Add wrapWithPanel() to all non-tabbed global and project preference
panes, giving them the same DialogTabLayoutPanel container styling as
tabbed panes. Add dialogTabPanelNoTabs class with reduced top padding
for hidden-tab panels.

Refactor project dialog dimension constants into
PreferencesDialogConstants and increase project dialog size by 20px
in each direction. Extract SECTION_CHOOSER_PADDING constant.

Override setTabPanelSize() in ProjectPreferencesPane and
ProjectPythonPreferencesPane for the narrower project dialog.
Use darkGreyBackground (rgb(78,92,104)) for buttons, small buttons,
and selects in theme-aware dialogs, with darkGreyInactive on active.

Add darkDialogControlBackground (rgb(93,106,116)) for text and number
inputs -- slightly lighter than buttons to distinguish editable fields.

Add dark theme styling for SmallButton via @eval ThemeColors constants,
scoped to rstudio-theme-aware-dialog.

Style number inputs (input[type="number"]) for dark theme support.
Replace the PNG-based table layout (9-cell border images) with a
simple div container styled with CSS border-radius and box-shadow.
Replace the GIF spinner with a pure CSS animated spinner.

Add dark theme styling for the container and spinner in theme-aware
dialogs. Add bottom margin to accommodate drop shadow within the
overflow-hidden curtain animation.
Remove border from AceEditorPreview iframe and use transparent body
background so the editor theme shows through cleanly.

Widen editor scroll speed sensitivity input from 38px to 60px to
prevent spin button overlap.

Fix VCS origin label text color in dark theme and change the
no-remote-origin placeholder from "none" to "(None)".
Listen for EditorThemeChangedEvent in ModalDialogBase so that
theme-aware dialogs update their rstudio-themes-dark class when
the user switches between light and dark editor themes while
a dialog is open.
Style the WidgetListBox component (used by the Publishing Accounts
list and other list widgets) for dark theme-aware dialogs with
appropriate background, border, selection highlight, and text colors.
Style the CheckBoxList component (used by the Accessibility
Announcements tab) for dark theme-aware dialogs.
Use a single intermediate color rgb(68, 80, 90) for all dialog
controls (buttons, inputs, selects) in dark theme-aware dialogs.
This sits between the active and inactive tab colors, providing
contrast regardless of the surrounding background.
The selected option in native select elements was showing as black
text on white background. Style option elements and the :checked
state for dark theme-aware dialogs.
Use the most-inactive background for better contrast on the
checked option in select elements.
When a select element has focus, the checked option uses the body
background color (rgb(50, 76, 99)) for a subtle blue tint instead
of the default browser blue highlight.
Adds color-scheme: dark to text/number inputs and textareas so the
browser renders native UI chrome (spin buttons, scrollbars) in dark
mode.
Replace color-scheme: dark with custom-styled webkit spin buttons
that match the RStudio dark theme colors.
Use the browser's native dark color-scheme instead of custom
spin button styling.
Adds a small moon icon button to the top-right of the dialog
header bar for theme-aware dialogs. Clicking it toggles the
rstudio-themes-dark class on the dialog, useful for testing
dark theme styling.
Use GWT Element/Style API instead of elemental2 to avoid type
mismatch issues with CSSProperties typed values.
Use the active tab background color for the selected section in
the preferences pane chooser for better contrast against the
most-inactive background.
Controls whether modal dialogs use dark styling when a dark editor
theme is active. Defaults to true. When disabled, dialogs always
use light styling regardless of editor theme.
Replace direct RStudioGinjector.getUserPrefs() call with @Inject
pattern using injectMembers and a private initialize method.
The InfoBar already supported dark styling via rstudio-themes-dark-grey
but not via the dialog-level rstudio-themes-dark class. Add matching
selectors so InfoBars in theme-aware dialogs display correctly.
The keyboard shortcut badges used nearly invisible dark-on-dark
rgba values. Use white-based rgba for better contrast in dark
theme-aware dialogs.
Make file system dialogs (Choose Directory, Open File, Save File)
theme-aware. Adds dark styling for the file list, breadcrumb bar,
filename input, browse button, and row selection highlight.
The DirectoryContentsWidget set an inline white background on the
RowTable, overriding any CSS. Move the background color to
RowTable.css and add dark theme overrides for the panel, selected
rows, and active selection.
- lighten info label text in dark theme for readability
- increase code block, insert tabset, and callout dialog heights
- disable pointer events on stale file browser contents during navigation
- gate theme toggle button behind SuperDevMode
- add idempotency guard to addThemeToggleButton()
- document userPrefs_ null-safety in syncDarkThemeClass()
- restore bottomPanel_ to private, add setBottomPanelPaddingRight()
- replace hardcoded dark theme RGB values with @eval ThemeColors constants
- cancel DirectoryContentsWidget progress timer on detach
- document intentional wrapWithPanel() omission in Appearance and PaneLayout panes
- show error to user in CheckForUpdatesDialog.onError()
- add trailing newline to PreferencesDialogBase.css
- normalize dark theme section comments to consistent format
- replace hardcoded rgba selection colors with darkRowSelected/darkRowFocused
  constants in RowTable.css and WidgetListBox.css
- clear pointer-events in DirectoryContentsWidget.onDetach()
@kevinushey
kevinushey force-pushed the feature/dark-theme-preferences-dialogs branch from 9a80920 to ff60fd9 Compare March 19, 2026 21:42
@kevinushey
kevinushey merged commit 6904bbc into main Mar 19, 2026
1 check failed
@kevinushey
kevinushey deleted the feature/dark-theme-preferences-dialogs branch March 19, 2026 21:42
gtritchie added a commit that referenced this pull request Mar 24, 2026
Addresses #10296

Add dark theme support for the New Project Wizard and Import Dataset
dialogs by opting them into the setThemeAware(true) mechanism from
PR #17242.

- Add setThemeAware(true) to NewProjectWizard, DataImportDialog,
  ImportFileSettingsDialog, and DataImportOptionsUiCsvLocale
- Add dark mode CSS overrides for wizard page selector items, sprite
  backgrounds, back button, disclosure arrow, and page backgrounds
- Add dark mode CSS for data import grid frame, code preview area,
  options blocks (shared and CSV-specific), and column types popup
- Propagate dark class from owning dialog to DataImportColTypesMenu
  popup via DOM walk using hasClassName for exact class matching
- Enable theme support for the data import GridViewerFrame iframe
- Add dark mode override for invalid package name highlight
gtritchie added a commit that referenced this pull request Mar 24, 2026
Addresses #10296

Add dark theme support for the New Project Wizard and Import Dataset
dialogs by opting them into the setThemeAware(true) mechanism from
PR #17242.

- Add setThemeAware(true) to NewProjectWizard, DataImportDialog,
  ImportFileSettingsDialog, and DataImportOptionsUiCsvLocale
- Add dark mode CSS overrides for wizard page selector items, sprite
  backgrounds, back button, disclosure arrow, and page backgrounds
- Add dark mode CSS for data import grid frame, code preview area,
  options blocks (shared and CSV-specific), and column types popup
- Propagate dark class from owning dialog to DataImportColTypesMenu
  popup via DOM walk using hasClassName for exact class matching
- Enable theme support for the data import GridViewerFrame iframe,
  gated on the owning dialog's dark state so the grid stays light
  when use_dark_theme_modal_dialogs is disabled
- Add dark mode override for invalid package name highlight
gtritchie added a commit that referenced this pull request Mar 24, 2026
Addresses #10296

Add dark theme support for the New Project Wizard and Import Dataset
dialogs by opting them into the setThemeAware(true) mechanism from
PR #17242.

- Add setThemeAware(true) to NewProjectWizard, DataImportDialog,
  ImportFileSettingsDialog, and DataImportOptionsUiCsvLocale
- Add dark mode CSS overrides for wizard page selector items, sprite
  backgrounds, disclosure arrows, and page backgrounds
- Create dedicated dark-mode back button sprites matching the standard
  dialog button colors (rgb(68,80,90) fill, rgb(12,31,48) border)
- Add dark mode CSS for data import grid frame, code preview area,
  options blocks (shared and CSV-specific), and column types popup
- Propagate dark class from owning dialog to DataImportColTypesMenu
  popup via DOM walk using hasClassName for exact class matching
- Enable theme support for the data import GridViewerFrame iframe,
  gated on the owning dialog's dark state so the grid stays light
  when use_dark_theme_modal_dialogs is disabled
- Set dark background on grid viewer container to prevent light flash
  while the iframe content loads
- Add dark mode override for invalid package name highlight
- Add spacing between Type dropdown and Package name field on the
  Create R Package page
gtritchie added a commit that referenced this pull request Mar 24, 2026
Addresses #10296

Add dark theme support for the New Project Wizard and Import Dataset
dialogs by opting them into the setThemeAware(true) mechanism from
PR #17242.

- Add setThemeAware(true) to NewProjectWizard, DataImportDialog,
  ImportFileSettingsDialog, and DataImportOptionsUiCsvLocale
- Add dark mode CSS overrides for wizard page selector items, sprite
  backgrounds, disclosure arrows, and page backgrounds
- Create dedicated dark-mode back button sprites matching the standard
  dialog button colors (rgb(68,80,90) fill, rgb(12,31,48) border)
- Add dark mode CSS for data import grid frame, code preview area,
  options blocks (shared and CSV-specific), and column types popup
- Propagate dark class from owning dialog to DataImportColTypesMenu
  popup via DOM walk using hasClassName for exact class matching
- Enable theme support for the data import GridViewerFrame iframe,
  gated on the owning dialog's dark state so the grid stays light
  when use_dark_theme_modal_dialogs is disabled; strip editor_dark
  and add editor_light to fully revert grid styling
- Set dark background on grid viewer container to prevent light flash
  while the iframe content loads
- Add dark mode override for invalid package name highlight
- Add spacing between Type dropdown and Package name field on the
  Create R Package page
gtritchie added a commit that referenced this pull request Mar 24, 2026
…17280)

Addresses #10296

Add dark theme support for the New Project Wizard and Import Dataset
dialogs by opting them into the setThemeAware(true) mechanism from
PR #17242.

- Add setThemeAware(true) to NewProjectWizard, DataImportDialog,
  ImportFileSettingsDialog, and DataImportOptionsUiCsvLocale
- Add dark mode CSS overrides for wizard page selector items, sprite
  backgrounds, disclosure arrows, and page backgrounds
- Create dedicated dark-mode back button sprites matching the standard
  dialog button colors (rgb(68,80,90) fill, rgb(12,31,48) border)
- Add dark mode CSS for data import grid frame, code preview area,
  options blocks (shared and CSV-specific), and column types popup
- Propagate dark class from owning dialog to DataImportColTypesMenu
  popup via DOM walk using hasClassName for exact class matching
- Enable theme support for the data import GridViewerFrame iframe,
  gated on the owning dialog's dark state so the grid stays light
  when use_dark_theme_modal_dialogs is disabled; strip editor_dark
  and add editor_light to fully revert grid styling
- Set dark background on grid viewer container to prevent light flash
  while the iframe content loads
- Add dark mode override for invalid package name highlight
- Add spacing between Type dropdown and Package name field on the
  Create R Package page
gtritchie added a commit that referenced this pull request Mar 26, 2026
Add setThemeAware(true) to all RSConnect/publishing dialog constructors
so they respect the user's dark theme preference for modal dialogs.

Dialogs updated:
- RSConnectDialog (abstract base, covers RSConnectDeployDialog)
- RSConnectPublishWizard
- RSConnectReconnectWizard
- RSConnectAccountWizard
- RSConnectCloudDialog
- EnvironmentVariablesDialog (inner class in RSConnectDeploy)
- Publish-failed error dialog (anonymous class in RSConnect)

Add dark mode CSS overrides in RSConnectDeploy.css for hardcoded light
colors (white backgrounds, light borders, status text colors).

Create dark icon variants for the RPubs logo (light gray "Pubs" text
instead of dark gray) used in both PublishRPubsPage and
RPubsUploadDialog.

Create dark variants of the 5 deploy illustration images with boosted
arrow and Shiny globe mesh visibility (3x alpha on light-colored
semi-transparent pixels).

Fix wizard body panel clipping in theme-aware dialogs: the
wizardBodyPanel negative margins (-10px) did not account for the
increased td.dialogContent padding (14px) added in #17242 for
theme-aware dialogs. Add a compound selector to increase the negative
margins to -14px for theme-aware wizards.
kevinushey added a commit that referenced this pull request Jun 17, 2026
The SuperDevMode-gated dark-theme toggle button (#17242) was injected into
the dialog caption, which sits before the dialog body in DOM order. As a
focusable <button> it became the first element returned by
getFocusableElements(), displacing the real first/last controls the modal
focus trap relies on. In dev/draft builds this broke initial keyboard focus
and Tab/Shift+Tab wrapping -- the Global Options keyboard-accessibility tests
failed in test:desktop-dev while passing in production builds (where the
button is never added).

It was an interim affordance for manually checking dark dialogs; the actual
dark-theme-modal support (the useDarkThemeModalDialogs pref and
syncDarkThemeClass) stays. Removing the button restores the focus order.
kevinushey added a commit that referenced this pull request Jun 18, 2026
…harness (#18013)

* fix data viewer pin-pagination test and lower the e2e global timeout

The "pinned column stays pinned across column pagination" test looked for
the pinned body cell in #gridBody, but #17977 moved pinned cells into the
frozen pane's own table (#pinnedBody). Point the selector at #pinnedBody.

Lower the global per-test timeout from 5 min to 2 min so a hung test fails
fast, and shift the slow-path budget to where it's actually needed:

- drop redundant (== global) and tighten-only (< global) test.setTimeout
  overrides, letting the global govern
- add test.setTimeout() to package-installing beforeAll hooks (and one
  in-test install) whose budgets exceed the new global, since a hook's
  timeout inherits the global and a cold-cache install would otherwise be
  killed mid-install

* support parallel e2e workers via per-worker home and hermetic R libraries

Running the Desktop suite with more than one worker previously clobbered
shared state. Partition the two remaining shared writers per worker,
activated only when workers > 1 (resolved into PW_TOTAL_WORKERS by
globalSetup) so the default single-worker run is unchanged:

- HOME / USERPROFILE: each worker copies the seeded template home into a
  per-parallel-index subtree, so RStudio user state, command history, and
  seeded AI credentials don't collide.
- R_LIBS_USER: each worker gets a hermetic hardlink clone of the prebuilt
  template library (not layered with it), so a test can install or remove
  packages -- including the uninstall/reinstall tests -- without racing on
  a shared library or leaking across workers. The clone uses fs.linkSync
  (portable to Windows/NTFS, no elevation), stays on the same volume as the
  template, and is built via a temp dir + atomic rename.

Validated with --workers=2: two workers ran concurrently with separate
homes and clones, and the DBI/praise uninstall tests passed alongside the
console tests.

* e2e: fail fast on disabled commands, name them, and fix tests it surfaced

executeCommand now waits for the target AppCommand to be enabled (not just
present) before dispatching, and on timeout throws an error naming the
command. Executing a disabled command otherwise trips a dev-build assertion
in AppCommand.execute() -- the handler never runs, surfacing as an opaque
"AppCommand executed when it was not enabled" client exception plus a
downstream hang. Gating here absorbs brief command-state lag and makes the
failure self-explanatory.

This surfaced that saveDocument unconditionally issued Save even when the
active document was already clean (createAndOpenFile writes the file to disk
then opens it, so Save is correctly disabled). Save only when the document
is dirty; the clean-state wait covers both branches. Fixes the multiline-
chunk, notebook-save, rmarkdown empty-chunk, and missing-packages-banner
tests.

Also: the dev run scripts now accept --timeout durations with units
(30s / 1m / 2000ms / bare ms), so a capped-timeout iteration loop reads
naturally instead of requiring raw milliseconds.

Separately, the data-viewer sidebar pin/unpin test asserted unpin by reading
column 2's header, but once unpinned the column returns to its far-left
position, scrolled out of the virtualized column window with no rendered
<th>; assert via the always-present sidebar pin icon instead.

* remove interim dev-only dark-theme toggle button from modal dialogs

The SuperDevMode-gated dark-theme toggle button (#17242) was injected into
the dialog caption, which sits before the dialog body in DOM order. As a
focusable <button> it became the first element returned by
getFocusableElements(), displacing the real first/last controls the modal
focus trap relies on. In dev/draft builds this broke initial keyboard focus
and Tab/Shift+Tab wrapping -- the Global Options keyboard-accessibility tests
failed in test:desktop-dev while passing in production builds (where the
button is never added).

It was an interim affordance for manually checking dark dialogs; the actual
dark-theme-modal support (the useDarkThemeModalDialogs pref and
syncDarkThemeClass) stays. Removing the button restores the focus order.

* e2e: make per-worker CDP ports deterministic to avoid cross-worker kills

The CDP port was random per worker (9231 + random 0..68). With a few parallel
workers there was a real chance two drew the same port, and since each launch
reclaims its port with `lsof :PORT | kill -9`, the second worker would kill the
first worker's live RStudio -- a likely source of SIGKILL / "target page
closed" flakiness under --workers > 1. Derive the port deterministically from
the parallel index (base + index) so workers never share one; the dev/logger
ports (+1000/+2000) follow and stay disjoint. PW_CDP_PORT still overrides.

* e2e: let executeCommand dispatch invisible commands; make @smoke opt-in

executeCommand gated on AppCommand.isEnabled(), which is enabled_ && isVisible().
doExecute() only requires enabled_, so an invisible programmatic command
(visible="false", e.g. restoreDefaultPaneAndTabLayoutNoPrompt) always reports
disabled yet dispatches fine -- the gate blocked it forever (10s "did not become
enabled"). This broke pane_layout.test.ts's afterAll resetUILayout when the test
ran in isolation. Expose isVisible() on the automation bridge and pass the gate
when isEnabled() || !isVisible(); visible commands keep the fail-fast behavior.

Also make the @smoke startup test opt-in. It idles 30s against a 30s timeout
(full runs cap it lower), so it is the first casualty under parallel load and is
redundant alongside the full suite. Exclude it from both projects by default via
grepInvert; opt in with PW_RUN_SMOKE=1. Give it its own 60s timeout so it is
usable when run.

* desktop: probe for a free rsession port to avoid collisions on concurrent launch

The Electron app chose the rsession backend www-port with generateRandomPort()
-- an unverified random number in [8080, 48080) -- and never re-picked it if
the bind failed. Two RStudio instances starting at the same time (e.g. parallel
E2E workers, or a user opening several projects at once) could draw the same
port; the second rsession then fails to bind with EADDRINUSE and the IDE never
loads. The existing EADDRINUSE retry in SessionHttpMethods only covers the
same-port restart race within one session, not initial cross-instance
collisions, so nothing recovered.

Add findFreePort(), which probes random candidates with a real bind on
127.0.0.1 and returns one that is actually free (falling back to an unverified
random port if probing fails). Allocate the port through it:

- generateNewPort() is now async and awaits findFreePort().
- launchFirst() now probes a fresh free port instead of reusing the unverified
  random port assigned at construction.
- buildLaunchContext()/launchNextSession() and the two call sites in
  main-window/session-launcher are threaded through the now-async port
  allocation; the session-exit and main-window launch paths handle the
  returned promise.

A narrow time-of-check/time-of-use window remains, but it is far smaller than
trusting an unverified random number, which was the dominant collision source
under parallel launches. Companion to the parallel-worker E2E support in this
branch.

* e2e: address pr review feedback on timeout headroom and crash-safe worker setup

* fix find-in-files replace overlapping an in-flight grep operation

GrepOperation::onStdout processed grep output against the shared
findResults() singleton without checking that the output belonged to the
current operation. When a Replace All superseded a still-draining find or
replace preview, the stopped operation's buffered stdout was processed
under the new operation's configuration -- corrupting its results and, in
replace mode, writing files under the wrong config. This surfaced as a
Replace All that modified the file on disk but reported "(No results
found)". Mirror the guard onContinue already applies: drop output once the
operation is no longer current.

Also keep the Replace All action disabled while a find or replace is in
flight (re-enabled when it ends or is stopped) so a replace cannot be
started over a running operation, and mirror the button's disabled state
to aria-disabled so it is observable. Wait for the find to finish in the
Replace All e2e tests.

* disable the find-in-files replace-mode toggle while a search runs

Entering replace mode before the find finished built the replace preview
from incomplete search results, so a non-regex replacement showed no
matches. Gate the Find->Replace toggle on the find completing (greyed out,
pointer input blocked, aria-disabled set) by folding it into the existing
disableReplace/enableReplace, which already run at find begin/end. The
Replace->Find toggle stays usable. The replace e2e tests now wait for the
find to finish before toggling.
kevinushey added a commit that referenced this pull request Jun 24, 2026
* reduce and unify padding on text inputs and selects

Commit 6904bbc (#17242) added padding: 4px 6px to dialog text
inputs and the GWT control rules (.gwt-TextBox/.gwt-ListBox) used
padding: 4px / 4px 6px. This read as overly padded, especially in
dark themes.

Introduce a shared @def CONTROL_PADDING (2px 5px) in themeStyles.css
and apply it to the select element, .gwt-TextBox/.gwt-PasswordTextBox/
.gwt-ListBox, and the .gwt-ListBox override, so text inputs and
selects share one compact, consistent padding across light and dark
themes.

* add NEWS entry for input/select padding fix
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.

3 participants