-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Expand the contextmenu
event to allow for providing custom context menus
#2943
Comments
There should be a method to remove a menu item as well. |
@Yay295 You remove a menu item by not including it in the |
Maybe it could also be based on the |
@lemnis That could work as well, but would have to be submitted as a separate proposal. Of course, the menu specified by the website would be placed at the top level (where the old |
I'm very interested to see a comeback to tackle custom context menu whether it will be via a btw, I also saw in some js-dom library I'm using that they had a option for showing a shortcut command at the right side, think that would also be useful... |
Since
<menu type="context">
has been removed in #2730 because Chrome deemed it hard to control using JavaScript, I propose the following expansion to thecontextmenu
event specification:Function
insertMenu(menu)
Where
menu
would be an array of objects with the following properties:checked: boolean
type
parameter is"checkbox"
or"radio"
(default:false
).command: "<element ID>"
checked
,default
,disabled
,events
,icon
,id
,label
,menu
,radiogroup
ortype
parameters are present.default: boolean
disabled: boolean
events: {...}
function
s where the parameters are the name of an HTML event.icon: "<image URL>"
id: "<menu item ID>"
contextmenucommand
event listener.label: "<label>"
command
parameter is not present and thetype
is not"separator"
menu: [...]
type
parameter is"menu"
radiogroup: "<radiogroup>"
type
parameter is"radio"
.type: "<type>"
Note that the"command"
A regular command with an associated action. This is the missing value default."checkbox"
Represents a command that can be toggled between two different states."menu"
Represents a submenu that can be opened."radio"
Represent one selection from a group of commands that can be toggled as radio buttons."separator"
Represents a separator between a group of commands."separator"
type can’t have any other parameters.Function
preventDefault()
Causes the default browser context menu to not be opened, but any custom context menu specified using
insertMenu(menu)
is still opened.The text was updated successfully, but these errors were encountered: