WebAPI/Softkey through context menu: Difference between revisions

m
Line 8: Line 8:


== Concept ==
== Concept ==
Gaia utilizes [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menu <menu>], [https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menuitem <menuitem>] and [https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/contextmenu "contextmenu"] to define captions, icons and handlers of the softkeys they want. Please see the sample code in the session below.
The reason to choose "contextmenu" attribute is because...
# The "contextmenu" attribute is used to provide a set of context menu to user agent and the app itself doesn't need to care about how these menus should be rendered.
# Developers can easily customize their own texts, icons and event handlers by using exist attributes of <menuitem>.
# The "contextmenu" can be overridden by each DOMElement within a page so that we can design different set of menus under different circumstances (e.g. focus on different elements).
<pre>
<pre>
<!DOCTYPE html>
<!DOCTYPE html>
Confirmed users
133

edits