question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add type for `onOpenAutoFocus` to ContextMenu.Content

See original GitHub issue

Bug 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

CodeSandbox

Your environment

Software Name(s) Version
Radix Package(s) @radix-ui/react-context-menu 0.0.10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
steveruizokcommented, Mar 22, 2021

Thats a good reference! I’ll investigate. Thanks for the support. 🙇‍♂️

1reaction
benoitgrelardcommented, Mar 22, 2021

No problem Steve!

Rather than wrapping elements of that SVG tree with triggers (which is how I understand this component to normally work), I would prefer to use just one trigger that wraps the whole SVG.

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 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found