Skip to content

fix(ui): name the ribbon's Project and collapse buttons for screen readers (#3052) - #3090

Merged
jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:fix/3052-ribbon-button-names
Nov 27, 2026
Merged

jgregoriorincon merged 1 commit into
opengeos:mainfrom
jgregoriorincon:fix/3052-ribbon-button-names

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Project button and the collapse/expand button of the ribbon's tab strip are painted over allocate_exact_size(…, Sense::click()) with no widget_info. Their accessibility nodes had the role Unknown, and their only name was the tooltip's text, which egui's on_hover_text copies to a node without one: "Open, save and create projects" for Project, and the collapse or expand caption (with the shortcut, when there is one) for the other.

Both now declare themselves as buttons, as the tabs and scroll arrows next to them do:

  • Project is named "Project".
  • The other is named "Collapse the ribbon" or "Expand the ribbon" for the ribbon's state, without the shortcut.

The tooltips are unchanged. No new strings.

Surfaces: the ribbon is drawn by the desktop app, the browser build, and the phone when it is switched to the desktop interface; the touch interface draws its own chrome. No command, shortcut or project format changes, so nothing changes for the command line, Python, command search, the Assistant, MCP or plugins.

Testing

Two new tests in crates/ui-egui/src/ribbon.rs, each finding the button by role and label and clicking it:

  • the_project_button_is_named_and_opens_the_backstage
  • the_collapse_button_is_named_for_its_state_and_toggles_the_ribbon (both states, there and back)

On the branch rebased on 9bdf3a96: cargo fmt --check, clippy on rustgis-ui-egui, nextest on the workspace without the DuckDB tests (9891 passed, 29 skipped), doctests, the layer check and the schema check all pass.

UI evidence

No visible UI change.

Related issue

Closes #3052

Summary by CodeRabbit

  • Accessibility
    • The Project and ribbon controls now expose button roles and accessible names, making them easier to identify with assistive technologies.
    • The ribbon’s accessible name reflects whether it is expanded or collapsed, so its current state is clearer.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Project and ribbon collapse/expand controls now expose accessible button roles and names. UI tests locate the controls by their accessible names and verify that they perform their actions.

Changes: Ribbon accessibility

Layer / File(s) Summary
Accessible ribbon controls
crates/ui-egui/src/ribbon.rs
The Project button exposes the name “Project.” The collapse/expand control exposes a name that reflects the ribbon state. Tests check that the Project button opens the backstage and that the collapse button toggles the ribbon.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: giswqs, elpidioassinaturas

Merge Risk: Minimal · up to 11bcf

This change gives the ribbon's Project and collapse/expand controls accessible names for screen readers, and tests cover both. The risk is low and nothing found should block merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the ribbon's Project and collapse buttons get accessible names for screen readers. It matches the raw summary, the PR objectives, and linked issue #3052. The title fol…
Description check Passed The description follows the template's main sections. The Summary explains the accessibility problem and the fix. Testing names the two new tests and the checks the author ran. The UI evidence section…
Linked Issues check Passed Issue #3052 requires (1) the Project button named "Project" with button role, (2) the collapse/expand button named "Collapse the ribbon" or "Expand the ribbon" by ribbon state with button role, and (3…
Out of Scope Changes check Passed The whole-PR diff against the merge base touches only crates/ui-egui/src/ribbon.rs. The production changes are two widget_info calls on the Project and collapse/expand buttons. The added tests exerc…
Full details: Title check

Explanation

The title names the main change: the ribbon's Project and collapse buttons get accessible names for screen readers. It matches the raw summary, the PR objectives, and linked issue #3052. The title follows the conventional commit style and is specific enough for a reviewer scanning history.

Full details: Description check

Explanation

The description follows the template's main sections. The Summary explains the accessibility problem and the fix. Testing names the two new tests and the checks the author ran. The UI evidence section states 'No visible UI change.', which the template allows when no visible change exists. The Related issue section has 'Closes #3052'. The template's UI evidence guidance applies only to visible changes, and the author's accessibility fix adds no visual change. The description is complete.

Full details: Linked Issues check

Explanation

Issue #3052 requires (1) the Project button named "Project" with button role, (2) the collapse/expand button named "Collapse the ribbon" or "Expand the ribbon" by ribbon state with button role, and (3) tests that find each control by label and activate it. The diff to crates/ui-egui/src/ribbon.rs meets all three. At the Project button (around line 280), presp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, tl_raw!("Project"))) is added. At the collapse/expand button (around line 369), cresp.widget_info(...) uses title, which is "Expand the ribbon" when ribbon_minimized is true and "Collapse the ribbon" otherwise. Two new tests, the_project_button_is_named_and_opens_the_backstage and the_collapse_button_is_named_for_its_state_and_toggles_the_ribbon, locate each button with get_by_role_and_label(Role::Button, ...), click it, and assert the backstage or ribbon state change in both directions. The tests were not executed in this review. The verdict rests on the diff, and the author reports a passing run.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base touches only crates/ui-egui/src/ribbon.rs. The production changes are two widget_info calls on the Project and collapse/expand buttons. The added tests exercise those same controls. No unrelated hunks appear in the diff. The PR description states that tooltips and strings are unchanged, and the diff matches this. The change set does not include command, shortcut, or project format changes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit taps the ribbon with care,
“Project” rings clear in the air.
“Collapse” and “Expand” say what they do,
The tests click each one through.
Then off the rabbit hops, ears high,
With accessible buttons by its side.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: e9d1a7d9-d214-41eb-97b8-9c57e84e491e
Commits

Reviewing files that changed from the base of the PR and between c21b0a0 and 11bcfcc.

Files selected for processing: 1

  • crates/ui-egui/src/ribbon.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security issues, performance problems, or AGENTS.md violations in this change. Confidence is high. The diff is one file (crates/ui-egui/src/ribbon.rs) and I read the surrounding code it touches.

Bugs: None.

  • The two widget_info calls (ribbon.rs:280, :369) run before on_hover_text, so the tooltip doesn't overwrite the accessible name.
  • The collapse label is computed eagerly, but the Project label is built inside the lazy closure, so it costs nothing unless accessibility is enabled.
  • tl_raw! is the logical-order form the fmt and tool-indicator code already use, so right-to-left names read correctly.

Security: None.

Performance: None. The added work is one string lookup per frame, and only when accessibility is on for the Project button.

Quality (nits, not for this pass):

  • "Project" now appears three times in tab_strip: two tl! calls and the new tl_raw!. One local binding would hold it.
  • The strip closure is duplicated in both new tests. A small helper would remove the repetition.

AGENTS.md: No violations.

  • No new unwrap, expect or panic.
  • Labels go through tl_raw!, and no new strings were added.
  • The change is egui-only, so it needs no cfg for wasm.
  • The new tests use assert! and fixed expected values.
  • The PR description states which surfaces it reaches.

Twins checked: Every Sense::click() allocation in ribbon.rs now has a widget_info call: the scroll arrows (:215), tab captions (:317), the Project button (:280), the collapse button (:369), the tool indicator (:381), the basemap tiles (:816) and the big buttons (:441). I did not check the phone interface in ui-touch, which the PR says draws its own chrome.

Earlier review threads: None on this PR, so no concerns were left alone.

Change size

Compared with the base branch: the whole PR against main (merge base 9bdf3a9 to PR head 11bcfcc).

Files changed Added Modified Removed Renamed Size before Size after Total change
1 0 1 0 0 308.9 KB 310.6 KB +1.7 KB
Path Size before Size after Size change
crates/ui-egui/src/ribbon.rs 308.9 KB 310.6 KB +1.7 KB

@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

Both quality nits are left as they are: they are style only, with no change in behaviour, and the branch is frozen after approval.

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3090/
Web app https://preview.rustgis.app/pr-3090/app/
Commit 11bcfcc

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 27, 2026
Merged via the queue into opengeos:main with commit 1a80975 Nov 27, 2026
28 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3052-ribbon-button-names branch November 27, 2026 08:45
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.

[Bug]: The ribbon's Project and collapse buttons are unnamed for screen readers

1 participant