Skip to content

feat(ui): add icon support for context submenus - #295

Closed
kveld9 wants to merge 1 commit into
crmne:mainfrom
kveld9:fix/add-to-playlist-submenu-icon
Closed

kveld9 wants to merge 1 commit into
crmne:mainfrom
kveld9:fix/add-to-playlist-submenu-icon

Conversation

@kveld9

@kveld9 kveld9 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds icon support to popup context submenus (menu_submenu), aligning them with standard context menu items.

Changes

  • Introduce menu_submenu helper in src/ui/widgets.rs, matching menu_item layout metrics (28px height, 16px icon slot, 26px text offset, BiDi layout, hover/open state) and appending the right arrow (egui::menu::SubMenuButton::RIGHT_ARROW).
  • Update Add to playlist to use Icon::ListPlus in both single-item (item_menu) and multi-selection (picked_menu) context menus.
  • Update Go to artist in item_menu to display Icon::User when multiple artists are present, consistent with the single-artist item.

Verification

  • Verified interactively with cargo run --features demo -- --demo --demo-page playlist:pl1.
  • Passed cargo fmt --all --check.
  • Passed cargo clippy --locked --all-targets -- -D warnings.
  • Passed cargo test --lib (310 passed).

Copilot AI left a comment

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.

🟢 Approval recommended

The change is localized to UI rendering, aligns with existing menu_item layout behavior, and the updated call sites are straightforward migrations.

Pull request overview

User-visible UI impact: Context menu submenus now display icons (and match the visual sizing/alignment of regular menu items), including an “Add to playlist” icon and an iconized multi-artist “Go to artist” submenu.

This PR adds a reusable UI helper to render submenu rows with the same layout metrics as existing popup menu items, then updates a couple of context menus to use it so submenu entries can show an icon consistently.

Changes:

  • Added menu_submenu in src/ui/widgets.rs to render a popup menu row that opens a child submenu, including hover and open-state styling and a trailing submenu arrow.
  • Updated “Add to playlist” in both single-item and multi-selection context menus to use the new helper and display Icon::ListPlus.
  • Updated the multi-artist “Go to artist” entry to use the new helper and display Icon::User.
File summaries
File Description
src/ui/widgets.rs Introduces menu_submenu and migrates relevant context menu submenus to use it with icon support.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@crmne crmne left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The submenu icons, row alignment and hover/focus styling are approved and integrated in 4294e55, with your authorship preserved. The local checks and hosted Linux, macOS, Windows and Nix checks pass. This is on main and has not been released yet. Thanks for the contribution and updated screenshots.

@kveld9
kveld9 force-pushed the fix/add-to-playlist-submenu-icon branch from a1fdfe5 to 8380afa Compare September 6, 2026 18:56
@kveld9

kveld9 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Here are the before and after comparisons in both dark and light themes:

Dark Theme

Before After
Before - Dark After - Dark

Light Theme

Before After
Before - Light After - Light

Verification & Accessibility

  • Visual consistency: Submenus previously rendered via egui's default menu_button, resulting in mismatched height, padding, and text misalignment against standard menu_item rows. menu_submenu aligns row height (28px), icon slot (16px), and hover styles across both themes.
  • Keyboard navigation: Added theme::focus_ring and widget_info to menu_submenu. Keyboard users can navigate to the submenu row, see the focus ring, and toggle/open via Space or Enter (covered by automated test menu_submenu_registers_focus_and_opens_from_keyboard).
  • Rebase & checks: Rebased onto latest main; passed all unit and integration tests (cargo test --features demo), clippy, and fmt.

@crmne

crmne commented Sep 12, 2026

Copy link
Copy Markdown
Owner

The visible changes are submenu icons, aligned row spacing and hover/focus styling. The supplied light/dark captures and keyboard regression address the earlier requests. Please rebase onto current main and add narrow-window captures in both themes so I can finish the visual review against the current menus.

@kveld9
kveld9 force-pushed the fix/add-to-playlist-submenu-icon branch from 8380afa to 55490a9 Compare September 13, 2026 18:45
@kveld9

kveld9 commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main.

Narrow-Window (760px) Captures

Dark Theme Light Theme
Dark - Narrow Light - Narrow

All checks and tests pass (cargo test --lib, cargo clippy, cargo fmt).

crmne pushed a commit that referenced this pull request Sep 14, 2026
Give Add to playlist and Go to artist submenu rows icons and consistent text, arrow, hover and focus layout. Preserve the existing child menus and actions. All nine contribution checks pass on the exact integrated tree; narrow and normal light/dark comparisons cover closed and open submenus.
@crmne crmne closed this Sep 14, 2026
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