Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

if contextmenu is deprecated how to replace it?

Tags:

html

css

I've heard contextmenu is deprecated: https://html.spec.whatwg.org/multipage/obsolete.html#attr-contextmenu

Then, Is there are ways to replace it?

like image 243
JillAndMe Avatar asked Aug 09 '19 06:08

JillAndMe


1 Answers

As the feature was not that popular, it is no longer supported.:

The support for HTML5 context menus, introduced with Firefox 8, will be removed soon. Other browser vendors were not interested in the feature, and therefore it has already been removed from the HTML spec, leaving Firefox as the only browser implementing the and elements as well as the contextmenu global attribute.

If desired, you can instead create your own context menu as seen in some rich web applications like Google Drive. The WAI-ARIA standard provides a way to create accessible menus which is highly recommended.

You can create your own menus using ARIA. Instead of <menu> & <menu-item> you use normal lists (<ul> & <li>), decorate them and use JS for functionality. You find more details and presets here and here.

like image 179
Meiswjn Avatar answered Oct 20 '22 20:10

Meiswjn