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

Using FileTrigger in Menu #4962

Closed
prabirshrestha opened this issue Aug 23, 2023 · 2 comments
Closed

Using FileTrigger in Menu #4962

prabirshrestha opened this issue Aug 23, 2023 · 2 comments
Labels
documentation Improvements or additions to documentation RAC

Comments

@prabirshrestha
Copy link

Provide a general summary of the feature here

I would like to invoke file trigger via a menu item.

🤔 Expected Behavior?

FileTrigger should be allowed for the menu item.

😯 Current Behavior

UI doesn't render correctly since it needs a pressable. I can add a button but then it won't render correctly.

<Item key="uploadFiles" textValue="Upload files">
  <FileTrigger>
    <ActionButton isQuiet>Upload files</ActionButton>
  </FileTrigger>
</Item>

image

💁 Possible Solution

Make isQuiet ActionButton render correctly when in Menu so it looks like any other menu item.

🔦 Context

Required for uploading a file via menu without showing a dialog or an extra button.

💻 Examples

No response

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@prabirshrestha
Copy link
Author

prabirshrestha commented Aug 23, 2023

I did find a workaround. Seems like you can create a FileTrigger with hidden ActionButton outside of the menu and add onMenuAction which will click the action button via uploadFilesRef.current?.UNSAFE_getDOMNode().click();. Might be just need a documentation update?

@LFDanLu
Copy link
Member

LFDanLu commented Aug 23, 2023

The MenuItem doesn't support a button as its contents for accessibility reasons (interactive child elements aren't supported) hence the weird rendering. Your workaround seems like the right way to go about it, we can certainly look into adding docs for this.

@LFDanLu LFDanLu added the documentation Improvements or additions to documentation label Aug 23, 2023
@github-project-automation github-project-automation bot moved this to ✏️ To Groom in RSP Component Milestones Aug 23, 2023
@devongovett devongovett closed this as not planned Won't fix, can't repro, duplicate, stale Nov 19, 2023
@github-project-automation github-project-automation bot moved this from ✏️ To Groom to ✅ Done in RSP Component Milestones Nov 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation RAC
Projects
Archived in project
Development

No branches or pull requests

3 participants