Back when the contextmenu event was defined in the HTML spec (see whatwg/html#7505 for context), it used the "fire a synthetic pointer event" algorithm for context menus opened via keyboard or other non-pointer input, as it does with non-pointer click events. This algorithm would set the event's button{,s} and {client,screen}{X,Y} fields to 0.
With the move of the contextmenu event to this spec, it is no longer clear what those fields should be set to for context menus not opened via pointer. And different browsers differ: Firefox sets button to 0, Chromium to -1, and WebKit (tested with GNOME Web on Linux) to 2. All browsers set buttons to 0, and they all seem to set {client,screen}{X,Y} to the coordinates where the context menu was opened.
Back when the
contextmenu
event was defined in the HTML spec (see whatwg/html#7505 for context), it used the "fire a synthetic pointer event" algorithm for context menus opened via keyboard or other non-pointer input, as it does with non-pointerclick
events. This algorithm would set the event'sbutton{,s}
and{client,screen}{X,Y}
fields to 0.With the move of the
contextmenu
event to this spec, it is no longer clear what those fields should be set to for context menus not opened via pointer. And different browsers differ: Firefox setsbutton
to 0, Chromium to -1, and WebKit (tested with GNOME Web on Linux) to 2. All browsers setbuttons
to 0, and they all seem to set{client,screen}{X,Y}
to the coordinates where the context menu was opened.