Skip to content

Comments

feat: create TooltipMenuTriggerCombo component#758

Closed
dominiccarrington wants to merge 4 commits intomomentum-design:masterfrom
dominiccarrington:feat/TooltipMenuTriggerCombo
Closed

feat: create TooltipMenuTriggerCombo component#758
dominiccarrington wants to merge 4 commits intomomentum-design:masterfrom
dominiccarrington:feat/TooltipMenuTriggerCombo

Conversation

@dominiccarrington
Copy link
Collaborator

@dominiccarrington dominiccarrington commented Feb 12, 2025

Description

This PR fixes 2 issues related to MenuTrigger:

  1. onOpenChange doesn't fire and a11y properties don't update when the user activates the trigger component using the keyboard.
  2. MenuTrigger with Tooltip as triggerComponent doesn't work correctly.

react-aria functionality doesn't fire when the trigger component is activated by the keyboard. This is causes the onOpenChange callback to not fire and a11y props (such as aria-expanded) to not update on the trigger component.

This PR makes the react-aria useMenuTriggerState control if the menu is open or not and makes the Popover trigger manually when the useMenuTriggerState.isOpen is updated. (like the Select component)
This causes a small breaking change if you are using Tooltips as the triggerComponent since tippy doesn't add the click event handler to the button anymore.

Additionally MenuTrigger doesn't provide all the props to the trigger component when using a Tooltip that it does normally when a button is provided directly. (for example aria-controls) This is because the properties don't get merged onto the Button but instead the Popover created by the Tooltip.

This PR creates a TooltipMenuTriggerCombo component, similar to TooltipPopoverCombo, which handles capturing the props given to the MenuTrigger triggerComponent and passes them to the button component instead.

Links

https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-615094
https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-616381

@dominiccarrington dominiccarrington added the validated If the pull request is validated automation. label Feb 13, 2025
@dominiccarrington dominiccarrington changed the title do not review: feat: create TooltipMenuTriggerCombo component feat: create TooltipMenuTriggerCombo component Feb 13, 2025
@dominiccarrington dominiccarrington marked this pull request as ready for review February 13, 2025 11:13
@dominiccarrington
Copy link
Collaborator Author

Closed in favour of the versions coming from momentum-design

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

validated If the pull request is validated automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant