Add type for `onOpenAutoFocus` to ContextMenu.Content
See original GitHub issueBug report
The ContextMenu.Context
element has a (useful) prop, onOpenAutoFocus
, that fires when the context menu opens. This prop works but is not included in the component’s type.
Reproducible example
Your environment
Software | Name(s) | Version |
---|---|---|
Radix Package(s) | @radix-ui/react-context-menu | 0.0.10 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Top Results From Across the Web
contextMenu(forSelectionType:menu:primaryAction:)
A view that can display an item-based context menu. Parameters. itemType. The identifier type of the items. Ensure that this matches the container's...
Read more >[ContextMenu][DropdownMenu] right click item should select
Right clicking on a context menu should behave as a normal (left) click that acts as a select and does not open the...
Read more >javascript - Selected input text by default (focus) in ContextMenu
I have a text field generated by contextmenu, and I want it to be selected by default (autofocus by default).
Read more >Context Menu - Radix UI
Prop, Type, Default ... The component that contains the context menu items. ... You can add special styles to disabled items via the...
Read more >Context menu items - Mozilla - MDN Web Docs
This user interface option adds one or more items to a browser context menu. This is the context menu available when a user...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thats a good reference! I’ll investigate. Thanks for the support. 🙇♂️
No problem Steve!
On this, I am curious why you would prefer to go for a single instance and having to change the content dynamically rather than multiple instances?
Here’s a quick sandbox showing multiple instances: https://codesandbox.io/s/contextmenu-svg-vuw8r?file=/src/App.js I imagine that in an app like yours you’d already have components for each type of node (like the circle one, the “branch” between 2 circles, etc) so each menu would be colocated with its component which IMO makes the whole thing a lot easier to think about.
That’s one of the reasons we have designed these APIs around component reuse rather than instance re-use so I’m curious what your train of thought was here in terms of wanting to avoid that 👍