Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom toggle title to be passed to MenuItems #6753

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Jan 7, 2025

Another attempt at fixing #6740.

As opposed to #6752, this PR keep MenuItem's label as ComponentChildren, but adds a new optional submenuToggleTitle string prop which is used as the submenu toggle title, if there's a submenu at all.

For backwards compatibility, if this prop is not provided, we still try to infer the title by templating `Show actions for ${label}`, but only if label is a string, to avoid the bug that we are trying to fix to still happen accidentally.

Closes #6740

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.43%. Comparing base (9b0a025) to head (a00e66b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6753   +/-   ##
=======================================
  Coverage   99.43%   99.43%           
=======================================
  Files         270      270           
  Lines       10196    10200    +4     
  Branches     2433     2437    +4     
=======================================
+ Hits        10138    10142    +4     
  Misses         58       58           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@acelaya acelaya force-pushed the submenu-toggle-title branch from 72187cb to 0b9e277 Compare January 7, 2025 13:48
@acelaya acelaya marked this pull request as ready for review January 7, 2025 13:48
Comment on lines +238 to +241
submenuToggleTitle ??
(typeof label === 'string'
? `Show actions for ${label}`
: `Toggle submenu`)
Copy link
Contributor Author

@acelaya acelaya Jan 7, 2025

Choose a reason for hiding this comment

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

For backwards compatibility, we still resolve the title `Show actions for ${label}` when submenuToggleTitle is not provided, but only if label is a string.

@acelaya acelaya requested a review from robertknight January 7, 2025 13:50
Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

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

LGTM

src/sidebar/components/MenuItem.tsx Outdated Show resolved Hide resolved
@acelaya acelaya force-pushed the submenu-toggle-title branch from 0b9e277 to a00e66b Compare January 10, 2025 09:26
@acelaya acelaya merged commit b70984b into main Jan 10, 2025
2 checks passed
@acelaya acelaya deleted the submenu-toggle-title branch January 10, 2025 09:28
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.

Groups submenu expand action has tooltip of "Show action for [object Object]"
2 participants