Skip to content

support multiple application warnings - #19459

Merged
kevinushey merged 12 commits into
mainfrom
feature/19108-warning-bar-messages
Nov 9, 2026
Merged

kevinushey merged 12 commits into
mainfrom
feature/19108-warning-bar-messages

Conversation

@kevinushey

@kevinushey kevinushey commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Application warnings currently replace one another, so startup warnings can disappear before the user handles them. This adds separate rows with independent actions and dismiss buttons, showing up to three rows before scrolling. Exact duplicate messages share a row, and dismissed messages are remembered in temporary session client state across reconnects; changed messages or severity can appear again.

Rows scroll vertically, with long messages clipped within their cells so controls remain visible. Every row has a keyboard-accessible Details dialog showing the full message. Named updates and removal keep memory, quota, license, and shortcut-report warnings confined to their own row. Closing another warning no longer disables shortcut reporting. Includes a NEWS entry linked to the issue.

Warnings follow the workbench in reading and tab order. Removing a focused row moves focus to the next or previous dismiss button, or to the console when no rows remain; background removal leaves focus alone. Closing Details also recovers focus if its warning resolved while the dialog was open. Short numbered group and button names distinguish warnings, and dismiss buttons describe their associated messages. Nearby warning updates are coalesced into one polite announcement outside the rows, excluding messages removed before announcement. Control padding preserves focus outlines with non-overlay scrollbars.

Closes #19108.

Validation:

  • ant build-unittests draft and the final ant draft passed.
  • All 15 focused GWT tests (WarningBarListTests, ApplicationWindowTests, and WorkbenchWarningTests) passed, covering independent actions/dismissals, updates, reconnect state, changed severity, bounded height, invalid saved state, restored memory dismissals, quota transitions, focus recovery, contextual labels, full-message details, batched announcements, and disabled announcements.
  • npm run typecheck passed in e2e/rstudio.
  • All six desktop Playwright scenarios passed on macOS; the expanded details-dialog case passed on a focused rerun after the final focus fix. Tests cover coexistence, non-overlay scrollbar geometry and focus outlines in light/dark themes, DOM order, keyboard dismissal, full-message details at 200% text size in a narrow viewport, dialog focus return, and a shared polite announcement. Runs use this worktree's GWT build with the existing C++ session binary and an unrelated startup warning enabled.
  • git diff --check passed.

Roborev Refine: the updated full-branch review passed with no actionable findings after one follow-up fix for dialog focus restoration. The follow-up commit review also passed. No LOW findings were reported or ignored.

Automated UI verification ran on macOS. The desktop test harness uses GWT dialogs (native_file_dialogs=false). Screen-reader speech, native desktop dialogs, and Windows/Linux runtime behavior still need hands-on verification.

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

Accessibility review against WCAG 2.2 AA, focused on keyboard and screen reader support. These findings come from code inspection only. Once a round of fixes is in, we'll do hands-on testing with a screen reader and keyboard, and a more general review of the PR as well.

Fix before merge

1. Warnings now precede the workbench in tab and reading order (1.3.2 Meaningful Sequence, 2.4.3 Focus Order).
The ApplicationWindow constructor now adds warnings_ to applicationPanel_ immediately, and showWorkbenchView() adds the workbench afterwards. LayoutPanel keeps children in insertion order, so the DOM order becomes header → warnings → main workbench, even though the warnings render at the bottom of the window. Tab moves from the toolbar into the warning dismiss buttons before reaching any pane, and screen readers list the "Warning bar" landmark before "Workbench". Before this PR, the bar was added lazily when a warning was shown, which usually placed it after the workbench. One fix: in showWorkbenchView(), use applicationPanel_.insert(workbenchScreen_, applicationPanel_.getWidgetIndex(warnings_)).

2. Dismissing a row by keyboard drops focus to <body> (2.4.3).
WarningBarList.remove() detaches the focused row. This already happened with a single bar, but with up to three rows plus scrolling, a keyboard user clearing several warnings has to tab back in from the top after each one. In dismiss(), if focus was inside the removed row, move it to the next row's dismiss button (or the previous row's). If no rows remain, move it to a sensible place in the workbench.

Should improve

3. Every dismiss button has the same accessible name.
Each row's button is "Dismiss Warning Bar". The row's group label gives context when tabbing in, so this technically passes 2.4.4 (purpose from programmatic context). However, a screen reader's buttons list shows several identical entries, and "Bar" is now inaccurate because each button closes a single warning. Suggest "Dismiss warning", with aria-describedby pointing at the message.

4. Messages are read twice in browse mode.
Each row is now a group whose aria-label is the full message, and the visually hidden live region inside it holds the same text. Reading through the page gives "group, ‹message›, ‹message›, Dismiss Warning Bar, button". This is verbosity rather than a failure. A short group label (or aria-labelledby pointing at the live region) would avoid it.

5. Truncated messages have no way to reveal the full text (1.4.4, 1.4.10).
Clipping predates this PR. The new ellipsis at least signals that text is missing, but sighted users, especially at high zoom or in narrow windows, can't read the rest. Screen reader users do get the full text. A title on label_ would be a cheap fix.

6. Simultaneous warnings may talk over each other (4.1.3 Status Messages).
Each row has its own role="alert" region. When several startup warnings arrive together, their assertive announcements can interrupt each other, and some screen readers drop the earlier ones. This is still better than before, when each warning replaced the last. Staggering announcements, or routing them through a single shared live region, would make them reliable.

Worth checking during hands-on testing

The .center cell that holds the dismiss button has overflow-x: hidden, and the new scroll container adds overflow-x: hidden as well. Confirm the dismiss button's focus ring isn't clipped, in both light and dark themes.

Improvements and passes

  • Moving the license button out of the clipped message cell means every row's controls stay visible and reachable.
  • A warning identical to one already shown doesn't re-announce, because the update skips setText.
  • Each row now has a group name, which gives screen reader users context, and the e2e test asserts these names.
  • 2.4.11 Focus Not Obscured: the workbench shrinks to make room for the warnings rather than being covered by them, and tabbing to a dismiss button scrolls it into view.
  • 2.1.1 Keyboard: every row in the scroll container has a focusable button, so all rows are reachable by keyboard.
  • 2.5.8 Target Size: the dismiss button is still 9×9 px but meets the spacing exception. Rows are 28 px apart and the action link is about 16 px away, so the 24 px circles don't overlap.

@gtritchie gtritchie added this to the 2026.12 (Parrot Balsam) milestone Nov 5, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

RStudio E2E - all platforms

All tests passed!

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

Passed Failed Skipped Flaky
5262 0 251 0
Platform ✅ Passed ❌ Failed ⚠️ Skipped 🔁 Flaky
✅ auth-teardown 4 0 16 0
✅ desktop-linux 1320 0 45 0
✅ desktop-macos 1315 0 51 0
✅ desktop-windows 1317 0 54 0
✅ server-linux 1258 0 53 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 5cac6c0bd457db8e64ffc46076680a014f4ed595 - Run #2113

Moving the workbench before the warnings in the DOM left the hidden warnings layer, which fills the panel until a warning sizes it, on top of the workbench, intercepting clicks.
@kevinushey

Copy link
Copy Markdown
Collaborator Author

Thanks, these are addressed in d229071 and 598382a, plus 9845e70:

  1. Order: the workbench is inserted before the warnings, and its layer is moved ahead of theirs in the DOM (LayoutPanel.insert orders widgets but appends their layers). The e2e test asserts the warnings follow main. The move exposed a regression that broke CI e2e: the hidden warnings layer still filled the panel and now sat above the workbench, swallowing clicks until the first warning appeared. 9845e70 hides the layer itself, with a regression test in ApplicationWindowTests.
  2. Focus: removing a focused row moves focus to the next row's dismiss button, then the previous one, then the console when no rows remain. Background removal leaves focus alone. Closing Details also recovers if its warning resolved while the dialog was open.
  3. Names: "Dismiss warning N", with aria-describedby pointing at the message. Numbering keeps the buttons list distinguishable. Numbers stay fixed for the session rather than following row position, so labels don't shift as rows close.
  4. Double read: the group label is now "Warning N" and the per-row live region is gone, so browse mode reads the message once.
  5. Truncation: the message has a title, and each row has a keyboard-reachable Details button that opens the full text in a dialog.
  6. Announcements: the per-row role="alert" regions are replaced by one role="status" region outside the landmark. Updates within the announcement delay are coalesced, and messages removed before it fires are dropped. These are now polite rather than assertive; let me know if severe warnings should stay assertive.

Focus ring: .controls padding keeps the outline inside the clipped cell. The e2e test measures outline geometry against the cell with non-overlay scrollbars in light and dark themes.

Ready for the hands-on pass.

@kevinushey
kevinushey requested a review from gtritchie November 6, 2026 03:45
The application warning bar renders messages as HTML, and the encoding comes verbatim from the .Rproj file.
…-bar-messages

# Conflicts:
#	src/gwt/test/org/rstudio/studio/client/RStudioUnitTestSuite.java

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

We haven't done screen-reader testing on this yet; we'll do that once this round of feedback is addressed.

A few problems that predate this PR are listed in a separate comment, with a suggestion to track them in a new issue.

@gtritchie

gtritchie commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

These problems predate this PR, so I'm not asking for them here. I'd suggest opening a new issue (or issues) to track them:

  • Memory escalation hidden after dismissal: after the "approaching memory limit" row is dismissed, the later "over memory limit" warning never gets a row, because Application.java:797 passes updateOnly=true and the row no longer exists. The old warningBar_ != null check had the same effect.
  • Severity isn't conveyed: the .warning and .error rules in WarningBar.css are empty, and the group name is "Warning N" either way, so severe and routine warnings look and sound the same.
  • Memory status re-announced every poll: the status text changes on each poll, so it is announced every 10 s. It used to be an alert and is now polite, which is better, but announcing only when the row appears or its severity changes would be quieter.
  • Fixed 28px rows: with text-only zoom or WCAG 1.4.12 text spacing, the controls overflow their row and get clipped.
  • No keyboard path to the warnings: they follow the workbench in tab order, Tab in the editor and console doesn't move focus, and there's no command to jump to them. Adding them to pane cycling, or adding a Focus Warnings command, would fix that.

- Relayout only when a row is added or removed, not on every refresh.
- Key the memory warning's dismissal and announcement on its limit state,
  not its live figures, so a dismissal survives a reload and polls are quiet.
- Replace an over-quota warning with the near-quota one when usage drops.
- Announce severe warnings in an assertive region.
- Scroll a new row into view unless a row has focus.
- Show the message's links in Details, and take them out of the row's tab
  order, where focusing them scrolled the clipped message.
- Number warnings by position.
- Undismiss, rather than hide and reshow, for the shortcut and test
  warnings.
- Remove the unused hideWarningBar(), hideWarning(), clear(), no-arg
  WarningBarClosedEvent and dismissWarningText messages.
@kevinushey

Copy link
Copy Markdown
Collaborator Author

Tracked in #19477. This PR now fixes the every-poll memory announcement (see the dismissal thread), so the issue covers the other four.

@kevinushey
kevinushey requested a review from gtritchie November 6, 2026 19:20

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

Thanks, the previous round of comments is addressed. One new problem: the last commit breaks an existing e2e test; details inline.

Roles.getStatusRole().set(status_.getElement());
Roles.getAlertRole().set(alert_.getElement());
announcement_.add(status_);
announcement_.add(alert_);

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 structure breaks tests/panes/plots/plot_alt_text.test.ts ("a ggplot2 plot uses its author alt text") on all three e2e platforms (linux-server shard 4, macOS desktop shard 6, Windows desktop shard 6), each failing with:

Expected one app status live region, found 2

The test finds the app's AriaLiveStatusWidget with div:has(> [role=status] + [role=alert]) > [role=status]. The announcement panel here is now a status region followed by an alert region in the same parent, so it matches too. Either give the warning announcements a structure that doesn't mirror AriaLiveStatusWidget, or make the test's selector specific to that widget (for example, an element ID on it).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in f9790c4: the app's AriaLiveStatusWidget now has the id rstudio_app_aria_live_status, and the test finds the status region through it instead of by structure. That also stops the selector depending on no command palette or dialog being open, since they embed the same widget. bdcd62c fixes a cleanup-order problem in the warnings scroll test that only showed up locally on macOS.

@gtritchie

Copy link
Copy Markdown
Member

Screen reader testing: NVDA 2026.03, Windows 11

Tested hands-on with a dev build of RStudio Desktop from this branch. Overall it worked very well.

How we drove it

The existing triggers (the showWarningBar command, Show Keyboard Shortcut Commands, and the desktop license hook) only cover some cases. Typing into DevTools also moves focus out of the RStudio window, which gets in the way of hearing live-region announcements. So we added a temporary local hook that was not committed:

  • SessionModuleContext.cpp: allowed show_warning_bar through .rs.enqueClientEvent.
  • ShowWarningBarEvent / Workbench.onShowWarningBar: accepted optional id, action, hide, and undismiss fields and mapped them onto the named, action, hideWarningBar, and undismissWarningBar APIs.

A small R helper (warn(message, severe, id, action, hide, undismiss)) then raised warnings from the console, so focus stayed in RStudio.

Scenarios

  • Five warnings at once, with mixed severity: scrolling past three rows, and the single coalesced announcement
  • Severe and non-severe messages
  • Exact duplicates sharing a row
  • Warnings with an action button
  • A named warning updated in place, removed, and shown again after dismissal
  • A long message containing a link: clipping, the Details dialog, the link removed from the row's tab order, and focus returning on Escape
  • Removing a row while it or the Details dialog had focus (delayed with later::later)
  • Focus moving after each dismissal, ending in the console when the last row closes
  • A dismissed message staying hidden after Help > Diagnostics > Reload UI, while a changed message reappears
  • Shortcut diagnostic live updates (Help > Diagnostics > Show Keyboard Shortcut Commands)

Observations

  • Announcements, row and button names, and the Details dialog all behaved as intended.
  • Reaching the warnings to close them by Tab is awkward because the Console and editor trap Tab by design. With the Tab key always moves focus accessibility option turned on, it was easy.
  • NVDA landmark navigation reaches the warnings directly through the "Warning bar" landmark.

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

Thanks for tackling the accessibility findings, this is working very nicely now. The tests need to be fixed so they pass (see comment) but otherwise LGTM!

kevinushey and others added 3 commits November 7, 2026 10:46
The warning announcement panel is now also a status region followed by an alert region, so the structural selector matched twice.
With the bar still clipped to one row, the last row's dismiss button could not be clicked, so the cleanup timed out locally on macOS.
@kevinushey
kevinushey merged commit 56eca70 into main Nov 9, 2026
1 of 7 checks passed
@kevinushey
kevinushey deleted the feature/19108-warning-bar-messages branch November 9, 2026 19:51
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.

Warning bar should hold more than one message

2 participants