How to dynamically close context menu after preventDefault on Menu Item #1447
-
I have a grid, where right clicking on each cell brings up a Context Menu. When I click the MenuItem that adds a column to the right, I want it to focus on the newly created cell. I tried preventDefault() on the MenuItem select handler in order to stop it focusing on the origin cell, however I don't know how to close the menu dynamically after that. Also attempting to dynamically focus on the newly created cell element doesn't seem to be working. Any ideas, at least on how to close the ContextMenu dynamically? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @flexa-david, Not sure if I fully understood what you're trying to achieve, but here's a quick and dirty demo of how you could achieve it (from my understanding) https://codesandbox.io/s/contextmenu-table-focus-xpk9fi?file=/src/App.js |
Beta Was this translation helpful? Give feedback.
Hey @flexa-david,
Not sure if I fully understood what you're trying to achieve, but here's a quick and dirty demo of how you could achieve it (from my understanding)
https://codesandbox.io/s/contextmenu-table-focus-xpk9fi?file=/src/App.js