react icon indicating copy to clipboard operation
react copied to clipboard

[ActionMenu.Button] onClick doesn't function

Open DavidMeu opened this issue 1 year ago • 10 comments

Description

When trying to pass a function to ActionMenu.Button it doesn't get invoked.

Image

Steps to reproduce

  1. Goto: https://primer.style/react/ActionMenu
  2. Overload onClick and see it doesn't get invoked on clicking.

Version

^36.19.1

Browser

No response

DavidMeu avatar Jun 06 '24 10:06 DavidMeu

Uh oh! @DavidMeu, the image you shared is missing helpful alt text. Check your issue body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

🤖 Beep boop! This comment was added automatically by github/accessibility-alt-text-bot.

github-actions[bot] avatar Jun 06 '24 10:06 github-actions[bot]

Not an expert on this, but I think the idea is that you'd leverage the onOpenChange property on the ActionMenu, rather than trying to catch the click on the button itself (which already has the behaviour attached to it to open/close the menu).

patrickhlauke avatar Jun 06 '24 10:06 patrickhlauke

Not an expert on this, but I think the idea is that you'd leverage the onOpenChange property on the ActionMenu, rather than trying to catch the click on the button itself (which already has the behaviour attached to it to open/close the menu).

I see what you are saying. The thing is I just need a simple onClick and I don't want to recreate this state just to overload my method.

DavidMeu avatar Jun 06 '24 11:06 DavidMeu

Hey! Can confirm that the onClick is overwritten. Can classify as bug.

Out of curiosity, what are you planning to do in the onClick handler?

siddharthkp avatar Jun 06 '24 14:06 siddharthkp

Hey! Can confirm that the onClick is overwritten. Can classify as bug.

Out of curiosity, what are you planning to do in the onClick handler?

I want to trigger a check to filter out options from the dropdown.

DavidMeu avatar Jun 06 '24 16:06 DavidMeu

I want to trigger a check to filter out options from the dropdown.

That's interesting, can you share more? (Note: This repository is open source. If the context is unreleased/sensitive, please share it on slack #primer instead)

siddharthkp avatar Jun 06 '24 16:06 siddharthkp

👋 @DavidMeu, this came up in the prioritisation call today. Can I get some context around what you are working on, that will help us if we need to prioritise a fix or recommend the workaround Patrick mentioned.

siddharthkp avatar Jun 10 '24 16:06 siddharthkp

👋 @DavidMeu, this came up in the prioritisation call today. Can I get some context around what you are working on, that will help us if we need to prioritise a fix or recommend the workaround Patrick mentioned.

This is part of devportal pipeline runs. Recently Heaven UI got deprecated and devportal will replace it by the end of the quarter. Here is the official release post.

DavidMeu avatar Jun 10 '24 17:06 DavidMeu

  • WIP: https://github.com/primer/react/pull/4648

siddharthkp avatar Jun 18 '24 14:06 siddharthkp

Hi @DavidMeu, sorry this fell through the cracks!

Would this still be useful for you?

siddharthkp avatar Aug 27 '24 12:08 siddharthkp

Hi @DavidMeu, sorry this fell through the cracks!

Would this still be useful for you?

Yes 🙏🏽

DavidMeu avatar Sep 01 '24 07:09 DavidMeu

@DavidMeu, this is now completed, should be part of the next release: https://github.com/primer/react/pull/4942

siddharthkp avatar Sep 13 '24 10:09 siddharthkp