A little b开发者_JAVA百科ackground first:
I'm designing a web application for a control system that will have a fairly restricted user base (so not everyone and their mother will be using it.)
I have lots of places where I will need a right click menu for doing specific things to the control page. Should I override the right click menu and implement my own or put a small icon or something else to invoke a menu? A good example of the separate icon approach is Google's music beta site. But personally, I hate having to click the little icon; I'd rather right click.
What is considered best practice?
It depends on your application imo. If your application is going to absolutely be limit to desktop users and you have functionality that emulates existing desktop functionality, then I might consider overriding the context menu.
Having said that, overriding the context menu violates the W3C One Web recommendation. If your user base may access your application from devices other than a desktop, you may be limiting them to what they can and can't do in your application (not all devices support right click).
The right-click context menu the browser provides is really useful. Please don't disable it through JavaScript. Provide an icon to pop up a menu, or even a series of icons or buttons to replace the menu. You can hide them until they're necessary if you feel they'll clutter up the screen. Twitter's Favorite/Retweet/Reply links are a good example of context-sensitive links appearing without the need for overriding the context menu.
精彩评论