Skip to content

feat(ui): submenus open at least 100 px wide, their rows as tall as the menu's (#2398) - #2400

Draft
jgregoriorincon wants to merge 1 commit into
opengeos:mainfrom
jgregoriorincon:feat/submenu-min-width
Draft

jgregoriorincon wants to merge 1 commit into
opengeos:mainfrom
jgregoriorincon:feat/submenu-min-width

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

A submenu whose rows are single words opened as a narrow strip beside its wider parent, e.g. Home › New Layout ▸ Publication Layout ▸ Letter (216 × 279 mm), whose styles (Classic, Banner, Panel…) opened 66 pt wide.

  • Submenus now open at least SUBMENU_MIN_W (100 pt) wide, half a ribbon menu's MENU_MIN_W (200 pt, now a named constant instead of five literals). Submenus whose rows are longer are unchanged.
  • Two shared helpers in widgets.rs, one per kind of menu, so the row that opens a submenu is as tall as the rows beside it:
    • widgets::submenu (new) for menus of plain buttons: Publication Layout and its page sizes, Primary Symbology, the RGB band menus, and the layer and tile context menus (Group, Extrusion, Extrusion Base, Blend, Draw as). Row heights are unchanged there.
    • widgets::submenu_row (existing) for menus of menu_item rows. The report's Report Section (Existing Template, Related Report, Subreport) and Data (Field, Statistics…) menus now use it, so those rows are as tall as their menu_item neighbours. Before, they were shorter.
  • Drop-down buttons that are not submenus ("⋯" in History, "Add ▾", "New Connection ▾" in Sources, Model Builder's Open, the STAC card's Bands/Index) and right-click menus themselves are left as they are.

The change is in ui-egui, so it reaches the desktop and the browser. The command line, Python and the Assistant have no menus to change.

Testing

  • checks.sh: cargo fmt --check, cargo clippy -p rustgis-ui-egui --all-targets -D warnings, cargo nextest on the whole workspace (7691 passed), doctests and cargo xtask layers, all exit 0.
  • New UI test ribbon::tests::a_submenu_of_short_rows_is_not_a_strip: opens New Layout ▸ Publication Layout ▸ Letter and checks that the styles' submenu is SUBMENU_MIN_W wide and that the Letter row is as tall as a figure row beside it. It fails on main, where the submenu is about 54 pt wide.
  • ui_shot screenshots before and after, measured: styles' submenu 66 → 112 pt wide (100 + margins), every row in Publication Layout 27 pt tall before and after.
  • Manual: the Letter and other page-size submenus, Report Section, and the Group submenu in a layer's context menu.

UI evidence

Before (main) / after, New Layout ▸ Publication Layout ▸ Letter (216 × 279 mm):

before-letter final-letter

Related issue

Closes #2398

…he menu's (opengeos#2398)

A submenu of one-word rows (New Layout > Publication Layout > a page size's styles) opened as a narrow strip. Submenus now open at least SUBMENU_MIN_W (100) wide, half a ribbon menu's MENU_MIN_W (200). widgets::submenu opens one from a menu of plain buttons; submenu_row, from a menu of menu_item rows, so the row is as tall as the rows beside it (the report's Report Section and Data menus now use it).
@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • 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

menu_item(ui, app, "new_layout", "New Template (a layout page)", "report.newTemplate", Value::Null);
let layouts: Vec<String> = app.session.project.layouts.iter().map(|l| l.name.clone()).collect();
ui.menu_button(tl!("Existing Template"), |ui| {
submenu_row(ui, "", tl!("Existing Template"), |ui| {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Possible unannounced interaction change (confidence: moderate, not verified by running the UI). This line, and the other report-menu calls converted to submenu_row (Related Report, Subreport, Field, Statistics, and the nested field submenus), switch from ui.menu_button to egui's SubMenuButton. As I understand egui, menu_button opens its popup on click, while SubMenuButton opens on hover. If that holds, these report menus change from click-to-open to hover-to-open. The PR description only mentions the row height for these menus. Please confirm the hover behaviour is intended, and say so in the PR, or keep these calls as submenu-style plain menus if click is wanted.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I read the full diff (three files in ui-egui), the PR metadata, the base-branch AGENTS.md, and the surrounding code for every changed helper. prior-reviews.json has no threads, so nothing was left alone as already raised. I could not build or run the tests or the UI here, so the layout claims in the PR (widths, heights, 7691 passing tests) are unverified.

Bugs

  • No bugs found. The new &str helpers type-check against tl!, which returns &str. submenu returns the Response that panes.rs now chains .on_hover_text onto, and nothing else in the diff changes behaviour. Confidence: high.

Security

  • None. The change is layout code with no input handling.

Performance

  • None.

Quality

  • widgets::submenu and widgets::submenu_row have near-identical names but differ in row style (menu_button with default height versus SubMenuButton with min height 24 and an icon slot). Callers in ribbon.rs now mix them (submenu(...) next to submenu_row(ui, "", ...)), and a reader cannot tell which to use from the name. Confidence: medium. Per AGENTS.md this can wait for the release quality pass.
  • ribbon.rs now imports submenu from widgets but reaches MENU_MIN_W by full path (crate::widgets::MENU_MIN_W). Nit. Confidence: high.
  • The new test covers the Publication Layout height and width, but nothing covers the report menus, which change row height through submenu_row. Nit, and a test-coverage point for the quality pass. Confidence: high.

AGENTS.md

  • The PR body still contains the placeholder <!-- drag before-letter.png and final-letter.png here -->, and no screenshots are attached. AGENTS.md requires before and after screenshots for any visible change, and this one is visible. Confidence: high. This is a PR-description fix, so it has no inline anchor.
  • The PR states the change reaches the desktop and browser, which fits (ui-egui is shared), but it does not mention ui-touch. Likely fine since the phone UI does not use these menus. Confidence: low.
  • ui.menu_button calls left in sourcespane.rs, textform.rs, chrome.rs, opendataui.rs, stacui.rs, modelbuilder.rs and panes.rs are top-level drop-downs, not submenus, so they match the PR's exclusion list. No finding.

Inline comment posted

  • crates/ui-egui/src/ribbon.rs:1262 (confidence: moderate). The report-menu calls switched from ui.menu_button to SubMenuButton. As I understand egui, that changes open-on-click to open-on-hover, and the PR does not mention it. Please confirm and state it in the PR. I could not check the egui source from here.

Change size

Compared: the whole PR against main (merge base 7e9718e to PR head 9f5c7be).

Measure Value
Files changed 3 (0 added, 3 modified, 0 removed, 0 renamed)
Size before 781.2 KB
Size after 783.4 KB
Total size change +2.8 KB
Path Before After Change
crates/ui-egui/src/ribbon.rs 278.4 KB 280.3 KB +1.9 KB
crates/ui-egui/src/widgets.rs 46.8 KB 47.6 KB +869 B
crates/ui-egui/src/panes.rs 456.1 KB 456.1 KB +40 B

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-2400/
Web app https://preview.rustgis.app/pr-2400/app/
Commit 9f5c7be

GitHub Pages takes a minute or two to publish a new commit.

This branch has not been deployed

No deployments
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]: Submenus get the same minimum width as the ribbon's menus

1 participant