-
Hi, we have a very specific use case in which we need to display a menu after the user has selected any text on an interface. So far we are doing that with a Popper from Material-UI. However, our designer is asking if we could change to use Paste Menu. From what I have seen so far the Menu and Menu Primitive are coupled to have a button. I have tried workarounds to do it without a button but no lucky on not breaking the user selection experience. Is there any suggested way to do this with Paste or we should stick for this scenario to the Material-UI implementation? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @PabloFNK, are you referring to the “fake reference” example on the material UI popper docs https://material-ui.com/components/popper/#faked-reference-object? We don’t currently have any solution for this, mainly for accessibility reasons. When showing a menu or non-modal dialog you must handle user focus, moving the user into the menu or dialog, and then returning the user back to the triggering element. This is why both the Menu and Popover are tied to having a trigger button. There isn’t really a good solution right now for context menus (right click). On Windows you can press a keyboard shortcut, but there isn’t an equivalent on Mac. The trick is working out a way to trigger the menu or the dialog from a keyboard shortcut and then returning them to the position they were in the text. It’s basically a Rich Text Editor, which we currently have no plans for. In the short term, I’d probably just use the Material Popper, and provide it UI built from Paste primitives like Box and Text. It looks like the popper is just a functional primitive and you can give it any UI to render. This way you get the design from Paste and functionality you need for your feature. All I ask is that you provide a keyboard shortcut to do the same thing as a mouse user. |
Beta Was this translation helpful? Give feedback.
Hi @PabloFNK, are you referring to the “fake reference” example on the material UI popper docs https://material-ui.com/components/popper/#faked-reference-object?
We don’t currently have any solution for this, mainly for accessibility reasons.
When showing a menu or non-modal dialog you must handle user focus, moving the user into the menu or dialog, and then returning the user back to the triggering element. This is why both the Menu and Popover are tied to having a trigger button.
There isn’t really a good solution right now for context menus (right click). On Windows you can press a keyboard shortcut, but there isn’t an equivalent on Mac. The trick is working out a way to trigger the me…