-
Notifications
You must be signed in to change notification settings - Fork 73
/
menu.xml
248 lines (241 loc) · 9.46 KB
/
menu.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<?xml version="1.0"?>
<entry name="menu" type="widget" widget-element="menu">
<title>Menu Widget</title>
<desc>
Themeable menu with mouse and keyboard interactions for navigation.
</desc>
<longdesc>
<p>A menu can be created from any valid markup as long as the elements have a strict parent/child relationship and each menu item has an anchor. The most commonly used element is the unordered list (<code><ul></code>):</p>
<pre><![CDATA[
<ul id="menu">
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a>
<ul>
<li><a href="#">Item 3-1</a></li>
<li><a href="#">Item 3-2</a></li>
<li><a href="#">Item 3-3</a></li>
<li><a href="#">Item 3-4</a></li>
<li><a href="#">Item 3-5</a></li>
</ul>
</li>
<li><a href="#">Item 4</a></li>
<li><a href="#">Item 5</a></li>
</ul>
]]></pre>
<p>If you use a structure other than <code><ul></code>/<code><li></code>, including using the same element for the menu and the menu items, use the <a href="#option-menus"><code>menus</code></a> option to specify a way to differentiate the two elements, e.g., <code>menus: "div.menuElement"</code>.</p>
<p>Any menu item can be disabled by adding the <code>ui-state-disabled</code> class to that element.</p>
<h3>Keyboard interaction</h3>
<ul>
<li>ENTER/SPACE: Invoke the focused menu item's action, which may be opening a submenu.</li>
<li>UP: Move focus to the previous menu item.</li>
<li>DOWN: Move focus to the next menu item.</li>
<li>RIGHT: Open the submenu, if available.</li>
<li>LEFT: Close the current submenu and move focus to the parent menu item. If not in a submenu, do nothing.</li>
<li>ESCAPE: Close the current submenu and move focus to the parent menu item. If not in a submenu, do nothing.</li>
</ul>
<p>Typing a letter moves focus to the first item whose title starts with that character. Repeating the same character cycles through matching items. Typing more characters within the one second timer matches those characters.</p>
<p>Disabled items can receive keyboard focus, but do not allow any other interaction.</p>
</longdesc>
<note id="functional-css"/>
<added>1.9</added>
<options>
<xi:include href="../includes/widget-option-disabled.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<option name="icons" type="Object" default='{ submenu: "ui-icon-carat-1-e" }'>
<desc>
Icons to use for submenus, matching an icon defined by the jQuery UI CSS Framework.
<ul>
<li>submenu (string, default: "ui-icon-carat-1-e")</li>
</ul>
</desc>
</option>
<option name="menus" type="String" default='"ul"'>
<desc>Selector for the elements that serve as the menu container, including sub-menus.</desc>
</option>
<option name="position" type="Object" default='{ my: "top left", at: "top right" }'>
<desc>Identifies the position of submenus in relation to the associated parent menu item. The <code>of</code> option defaults to the parent menu item, but you can specify another element to position against. You can refer to the <a href="/position/">jQuery UI Position</a> utility for more details about the various options.</desc>
</option>
<option name="role" type="String" default='"menu"'>
<desc>Customize the ARIA roles used for the menu and menu items. The default uses <code>"menuitem"</code> for items. Setting the <code>role</code> option to <code>"listbox"</code> will use <code>"option"</code> for items. If set to <code>null</code>, no roles will be set, which is useful if the menu is being controlled by another element that is maintaining focus.</desc>
</option>
</options>
<methods>
<method name="blur">
<desc>
Removes focus from a menu, resets any active element styles and triggers the menu's <a href="event-blur"><code>blur</code></a> event.
</desc>
<argument name="event" type="Event" optional="true">
<desc>What triggered the menu to blur.</desc>
</argument>
</method>
<method name="collapse">
<desc>
Closes the currently active sub-menu.
</desc>
<argument name="event" type="Event" optional="true">
<desc>What triggered the menu to collapse.</desc>
</argument>
</method>
<method name="collapseAll">
<desc>
Closes all open sub-menus.
</desc>
<argument name="event" type="Event" optional="true">
<desc>What triggered the menu to collapse.</desc>
</argument>
<argument name="all" type="Boolean" optional="true">
<desc>Indicates whether all sub-menus should be closed or only sub-menus below and including the menu that is or contains the target of the triggering event.</desc>
</argument>
</method>
<xi:include href="../includes/widget-method-destroy.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<xi:include href="../includes/widget-method-disable.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<xi:include href="../includes/widget-method-enable.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<method name="expand">
<desc>
Opens the sub-menu below the currently active item, if one exists.
</desc>
<argument name="event" type="Event" optional="false">
<desc>What triggered the menu to expand.</desc>
</argument>
</method>
<method name="focus">
<desc>
Activates a particular menu item, begins opening any sub-menu if present and triggers the menu's <a href="#event-focus"><code>focus</code></a> event.
</desc>
<argument name="event" type="Event" optional="false">
<desc>What triggered the menu item to gain focus.</desc>
</argument>
<argument name="item" type="jQuery" optional="false">
<desc>The menu item to focus/activate.</desc>
</argument>
</method>
<method name="isFirstItem">
<desc>
Returns a boolean value stating whether or not the currently active item is the first item in the menu.
</desc>
</method>
<method name="isLastItem">
<desc>
Returns a boolean value stating whether or not the currently active item is the last item in the menu.
</desc>
</method>
<method name="next">
<desc>
Moves active state to next menu item.
</desc>
<argument name="event" type="Event" optional="true">
<desc>What triggered the focus to move.</desc>
</argument>
</method>
<method name="nextPage">
<desc>
Moves active state to first menu item below the bottom of a scrollable menu or the last item if not scrollable.
</desc>
<argument name="event" type="Event" optional="true">
<desc>What triggered the focus to move.</desc>
</argument>
</method>
<xi:include href="../includes/widget-method-option.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<method name="previous">
<desc>
Moves active state to previous menu item.
</desc>
<argument name="event" type="Event" optional="true">
<desc>What triggered the focus to move.</desc>
</argument>
</method>
<method name="previousPage">
<desc>
Moves active state to first menu item above the top of a scrollable menu or the first item if not scrollable.
</desc>
<argument name="event" type="Event" optional="true">
<desc>What triggered the focus to move.</desc>
</argument>
</method>
<method name="refresh">
<desc>
Initializes sub-menus and menu items that have not already been initialized. New menu items, including sub-menus can be added to the menu or all of the contents of the menu can be replaced and then initialized with the <code>refresh()</code> method.
</desc>
</method>
<method name="select">
<desc>
Selects the currently active menu item, collapses all sub-menus and triggers the menu's <a href="#event-select"><code>select</code></a> event.
</desc>
<argument name="event" type="Event" optional="true">
<desc>What triggered the selection.</desc>
</argument>
</method>
<xi:include href="../includes/widget-method-widget.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
</methods>
<events>
<event name="blur" type="menublur">
<desc>
Triggered when the menu loses focus.
</desc>
<argument name="event" type="Event"/>
<argument name="ui" type="Object">
<property name="item" type="jQuery">
<desc>
The currently active menu item.
</desc>
</property>
</argument>
</event>
<xi:include href="../includes/widget-event-create.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
<event name="focus" type="menufocus">
<desc>
Triggered when a menu gains focus or when any menu item is activated.
</desc>
<argument name="event" type="Event"/>
<argument name="ui" type="Object">
<property name="item" type="jQuery">
<desc>
The currently active menu item.
</desc>
</property>
</argument>
</event>
<event name="select" type="menuselect">
<desc>
Triggered when a menu item is selected.
</desc>
<argument name="event" type="Event"/>
<argument name="ui" type="Object">
<property name="item" type="jQuery">
<desc>
The currently active menu item.
</desc>
</property>
</argument>
</event>
</events>
<example>
<desc>A simple jQuery UI Menu</desc>
<code><![CDATA[
$( "#menu" ).menu();
]]></code>
<css><![CDATA[
.ui-menu {
width: 200px;
}
]]></css>
<html><![CDATA[
<ul id="menu">
<li><a href="#">Item 1</a></li>
<li><a href="#">Item 2</a></li>
<li><a href="#">Item 3</a>
<ul>
<li><a href="#">Item 3-1</a></li>
<li><a href="#">Item 3-2</a></li>
<li><a href="#">Item 3-3</a></li>
<li><a href="#">Item 3-4</a></li>
<li><a href="#">Item 3-5</a></li>
</ul>
</li>
<li><a href="#">Item 4</a></li>
<li><a href="#">Item 5</a></li>
</ul>
]]></html>
</example>
<category slug="widgets"/>
</entry>