Skip to content

feat: truncate long text in menu items#9946

Open
LappiLappland wants to merge 1 commit into
RaspberryPiFoundation:mainfrom
LappiLappland:feat/truncate-long-menu-items
Open

feat: truncate long text in menu items#9946
LappiLappland wants to merge 1 commit into
RaspberryPiFoundation:mainfrom
LappiLappland:feat/truncate-long-menu-items

Conversation

@LappiLappland
Copy link
Copy Markdown

The basics

The details

Resolves

Fixes #9930

Proposed Changes

In MenuItem truncate text if it is longer than maxDisplayLength. Bind tooltip to element if text got truncated

Behaviour is similar to existing code in Field -> defining max length and manually truncating text

Does not truncate text if HTML element was passed. The default value of 50 is consistent with existing limits used elsewhere (Tooltip limit, Field limit)

Existing tooltips API is used to display tooltip text

Reason for Changes

Options' text in some menus (context menus, variable menu) is determined by user input. Dynamic options for variable/procedure names can span beyond screen

Test Coverage

Added 2 tests to menu_item_test.js

  1. Verify that long text gets truncated and binds tooltip
  2. Verify that short text does not get truncated and doesn't bind tooltip

Documentation

Additional Information

@LappiLappland LappiLappland requested a review from a team as a code owner May 28, 2026 17:33
@LappiLappland LappiLappland requested a review from maribethb May 28, 2026 17:33
@github-actions github-actions Bot added the PR: feature Adds a feature label May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: feature Adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make option length in menus limited

2 participants