Editor Menubar Example
-
- The following example demonstrates using the
- menubar design pattern
- to provide access to sets of actions.
- Each item in the below menubar identifies a category of text formatting actions that can be executed from its submenu.
- The submenus also demonstrate menuitemradio
and menuitemcheckbox
elements.
-
Similar examples include:
--
-
- Navigation Menubar Example: A menubar that presents site navigation menus. -
Editor Menubar Example
+
+ The following example demonstrates using the
+ menubar design pattern
+ to provide access to editing actions for a text area.
+ Each item in the menubar identifies a category of text formatting actions that can be executed from its submenu.
+ The submenus demonstrate menuitemradio
and menuitemcheckbox
elements.
+
Similar examples include:
+-
+
- Toolbar Example: A text formatting toolbar that uses roving tabindex to manage focus and contains several types of controls, including toggle buttons, radio buttons, a menu button, a spin button, a checkbox, and a link. +
- Navigation Menubar Example: A menubar that presents site navigation menus. +
Example
+Example
+-
- Font
+ Font
-
-
- Sans-serif -
- Serif -
- Monospace -
- Fantasy +
- Sans-serif +
- Serif +
- Monospace +
- Fantasy
-
- Style/Color
+ Style/Color
-
-
-
- Bold -
- Italic +
- Bold +
- Italic
-
-
-
- Black -
- Blue -
- Red -
- Green +
- Black +
- Blue +
- Red +
- Green
-
-
-
- None -
- Overline -
- Line-through -
- Underline +
- None +
- Overline +
- Line-through +
- Underline
-
-
- Text Align
+ Text Align
-
-
- Left -
- Center -
- Right -
- Justify +
- Left +
- Center +
- Right +
- Justify
-
- Size
+ Size
- Smaller
- Larger
-
-
-
- X-Small -
- Small -
- Medium -
- Large -
- X-Large +
- X-Small +
- Small +
- Medium +
- Large +
- X-Large
Example
Accessibility Features
--
-
- Users of assistive technologies can identify which format settings are selected because they are represented by menu item radio and menu item checkbox elements that have a checked state. -
- Disabled menu items are demonstrated in the font size menu, which includes two disabled menuitems. +
-
+ Disabled menu items are demonstrated in the font size menu.
+ If the font is set to its smallest size, the
Smaller
menu item is disabled. + Similarly, if the font is set to its largest size, theLarger
menu item is disabled. +
+ - Users of assistive technologies can identify the currently active format options because they are represented by menu item radio and menu item checkbox elements that have a checked state. +
- To prevent the character entities that visually represent The down arrow and checked icons from being announced by screen readers, they are hidden from the accessible name computation with the
aria-hidden
attribute. - To help communicate that the arrow keys are available for directional navigation within the menubar and its submenus, a border is added to the menubar container when focus is within the menubar. -
- To support operating system high contrast settings, focus is highlighted by adding and removing a border around the menu item with focus. -
- The down arrow and checked icons are made compatible with operating system high contrast settings and hidden from screen readers by using the CSS
content
property to render images. - - Like desktop menubars, submenus open on mouse hover over a parent item in the menubar only if another submenu is already open. + Like most desktop menubars, submenus open on mouse hover over a parent item in the menubar only if another submenu is already open. That is, if all submenus are closed, a click on a parent menu item is required to display a submenu. - Minimizing automatic popups makes exploring with a screen magnifier easier. + Minimizing automatic popups triggered by hover makes exploring with a screen magnifier easier.
-
In general, moving focus in response to mouse hover is avoided in accessible widgets; it causes unexpected context changes for keyboard users.
However, like desktop menubars, there are two conditions in this example menubar where focus moves in response to hover in order to help maintain context for users who use both keyboard and mouse:
-
-
+
- After a parent menu item in the menubar has been activated and the user hovers over a different parent item in the menubar, focus will follow hover.
- When a submenu is open and the user hovers over an item in the submenu, focus follows hover. -
-
+
-
+ - To support operating system high contrast settings, focus is highlighted by adding and removing a border around the menu item with focus. +
Menubar
tabindex="-1"
+ tabindex="-1"
span
@@ -428,7 +426,7 @@ Menubar
tabindex="0"
+ tabindex="0"
span
@@ -440,10 +438,10 @@ Menubar
part of the tab sequence of the page.menuitem
in the menubar
has tabindex="0"
.
+ Only one menuitem
in the menubar
has tabindex="0"
.
tabindex="0"
.
+ When the page loads, the first item in the menubar has tabindex="0"
.
Menubar
aria-haspopup="true"
+ aria-haspopup="true"
span
@@ -466,299 +464,349 @@ Menubar
aria-expanded="true"
+ aria-expanded="true"
span
-
+
- Indicates the submenu is open. +
-
+ The visual appearance of the expanded state is synchronized with the
aria-expanded
value using CSS attribute selectors and hidden from screen readers witharia-hidden="true"
. +
+
aria-expanded="false"
+ aria-expanded="false"
+ span
+ -
+
- Indicates the submenu is closed. +
-
+ The visual appearance of the expanded state is synchronized with the
aria-expanded
value using CSS attribute selectors and hidden from screen readers witharia-hidden="true"
. +
+
aria-hidden="true"
span
Submenu
Role | -Attribute | -Element | -Usage | -
---|---|---|---|
- menu
- |
- - |
- ul
- |
-
-
|
-
- |
- aria-label="string"
- |
-
- ul
- |
-
- Defines an accessible name for the menu .
- |
-
- menuitem
- |
- - |
- li
- |
-
-
|
-
- |
- tabindex="-1"
- |
-
- li
- |
- - Makes the item focusable but not part of the page tab sequence. - | -
- |
- aria-disabled="false"
- |
-
- li
- |
- - Used on the font size "Smaller" and "Larger" options to indicate they are active. - | -
- |
- aria-disabled="true"
- |
-
- li
- |
- - Used on the font size "Smaller" and "Larger" options to indicate one of the options is not active because the largest or smallest font has been selected. - | -
- menuitemcheckbox
- |
- - |
- li
- |
-
-
|
-
- |
- tabindex="-1"
- |
-
- li
- |
- - Makes the menuitemcheckbox focusable but not part of the page tab sequence. - | -
- |
- aria-checked="true"
- |
-
- li
- |
-
-
|
-
- |
- aria-checked="false"
- |
-
- li
- |
-
-
|
-
- separator
- |
- - |
- li
- |
-
-
|
-
- group
- |
- - |
- ul
- |
-
-
|
-
- |
- aria-label="string"
- |
-
- ul
- |
- - Provides an accessible name for the group of menu items. - | -
- menuitemradio
- |
- - |
- li
- |
-
-
|
-
- |
- tabindex="-1"
- |
-
- li
- |
- - Makes the menuitemradio focusable but not part of the page tab sequence. - | -
- |
- aria-checked="true"
- |
-
- li
- |
-
-
|
-
- |
- aria-checked="false"
- |
-
- li
- |
-
-
|
-
Role | +Attribute | +Element | +Usage | +
+ menu
+ |
+ + |
+ ul
+ |
+
+
|
+
+ |
+ aria-label="string"
+ |
+
+ ul
+ |
+
+ Defines an accessible name for the menu .
+ |
+
+ menuitem
+ |
+ + |
+ li
+ |
+
+
|
+
+ |
+ tabindex="-1"
+ |
+
+ li
+ |
+ + Makes the item focusable but not part of the page tab sequence. + | +
+ |
+ aria-disabled="false"
+ |
+
+ li
+ |
+ + Used on the font size "Smaller" and "Larger" options to indicate they are active. + | +
+ |
+ aria-disabled="true"
+ |
+
+ li
+ |
+ + Used on the font size "Smaller" and "Larger" options to indicate one of the options is not active because the largest or smallest font has been selected. + | +
+ menuitemcheckbox
+ |
+ + |
+ li
+ |
+
+
|
+
+ |
+ tabindex="-1"
+ |
+
+ li
+ |
+ + Makes the menuitemcheckbox focusable but not part of the page tab sequence. + | +
+ |
+ aria-checked="true"
+ |
+
+ li
+ |
+
+
|
+
+ |
+ aria-checked="false"
+ |
+
+ li
+ |
+
+
|
+
+ |
+ aria-hidden="true"
+ |
+
+ span
+ |
+
+ Removes the character entities that visually represent the checked state of menuitemcheckbox elements from the accessibility tree to prevent them from being included in the accessible name of the menu item.
+ |
+
+ separator
+ |
+ + |
+ li
+ |
+
+
|
+
+ group
+ |
+ + |
+ ul
+ |
+
+
|
+
+ |
+ aria-label="string"
+ |
+
+ ul
+ |
+ + Provides an accessible name for the group of menu items. + | +
+ menuitemradio
+ |
+ + |
+ li
+ |
+
+
|
+
+ |
+ tabindex="-1"
+ |
+
+ li
+ |
+ + Makes the menuitemradio focusable but not part of the page tab sequence. + | +
+ |
+ aria-checked="true"
+ |
+
+ li
+ |
+
+
|
+
+ |
+ aria-checked="false"
+ |
+
+ li
+ |
+
+
|
+
+ |
+ aria-hidden="true"
+ |
+
+ span
+ |
+
+ Removes the character entities that visually represent the checked state of menuitemradio elements from the accessibility tree to prevent them from being included in the accessible name of the menu item.
+ |
+
Textarea
- aria-label="string"
+ aria-label="string"
|
textarea
@@ -789,7 +837,7 @@ TextareaJavascript and CSS Source Code-
| |||
---|---|---|---|---|
- | aria-labelledby="IDREF" |
+ aria-labelledby="ID_REFERENCE" |
ul |
Refers to the heading element that contains the label that identifies the purpose of the tree . |
- | tabindex="-1" |
+ tabindex="-1" |
li |
Role, Property, State, and Tabindex Attributes |
- | tabindex="0" |
+ tabindex="0" |
li |
|
- | aria-expanded="false" |
+ aria-expanded="false" |
li |
Role, Property, State, and Tabindex Attributes |
- | aria-expanded="true" |
+ aria-expanded="true" |
li |
Role, Property, State, and Tabindex Attributes |
+ | aria-selected="false" |
+ li |
+
+
|
+ |
+ | aria-selected="true" |
+ li |
+
+
|
+ |
group |
@@ -464,15 +503,15 @@ |
Javascript and CSS Source Code
-
diff --git a/examples/treeview/treeview-1/treeview-1b.html b/examples/treeview/treeview-1/treeview-1b.html
index 4cc681a4fd..36e2b55fcc 100644
--- a/examples/treeview/treeview-1/treeview-1b.html
+++ b/examples/treeview/treeview-1/treeview-1b.html
@@ -12,6 +12,9 @@
+
+
@@ -28,15 +31,16 @@
File Directory Treeview Example Using Declared Properties
- The below example implements the - Treeview Design Pattern - to simulate a file selector. - When users activate an item that represents a file name in the below tree, the name of the selected file appears in the read-only edit field next to the tree. + The following example implementation of the + Tree View Design Pattern + simulates a widget for selecting a file or folder from within a hierarchical file system for viewing in a file viewer. + In the
My Documents
tree, each parent node represents a folder and each end node represents a file. + Activating a node selects the node and puts the name of the folder or file in the read-only edit field that represents the file viewer.The code in this example explicitly declares values for
+ The ARIA specification for these properties states that browsers can, but are not required to, compute these values. +aria-setsize
,aria-posinset
andaria-level
, which overrides browser computation of values for these properties. - The ARIA 1.0 specification for these properties states that browsers can, but are not required to, compute these values. -Similar examples include:
- File Directory Treeview using computed properties @@ -48,369 +52,414 @@
-
-
- Projects
-
-
-
-
- - project-1.docx - -
- - project-2.docx - -
-
-
- project-3
-
-
-
-
- - project-3A.docx - -
- - project-3B.docx - -
- - project-3C.docx - -
- - - project-4.docx - -
-
-
- project-5
-
-
-
-
- - project-5A.docx - -
- - project-5B.docx - -
- - project-5C.docx - -
- - project-5D.docx - -
- - project-5E.docx - -
- - project-5F.docx - -
-
- -
-
- Reports
-
-
-
-
-
-
- report-1
-
-
-
-
- - report-1A.docx - -
- - report-1B.docx - -
- - report-1C.docx - -
- -
-
- report-2
-
-
-
-
- - report-2A.docx - -
- - report-2B.docx - -
- - report-2C.docx - -
- - report-2D.docx - -
- -
-
- report-3
-
-
-
-
- - report-3A.docx - -
- - report-3B.docx - -
- - report-3C.docx - -
- - report-3D.docx - -
-
- -
-
- report-1
-
-
-
-
- Letters
-
-
-
-
-
-
- letter-1
-
-
-
-
- - letter-1A.docx - -
- - letter-1B.docx - -
- - letter-1C.docx - -
- -
-
- letter-2
-
-
-
-
- - letter-2A.docx - -
- - letter-2B.docx - -
- - letter-2C.docx - -
- - letter-2D.docx - -
- -
-
- letter-3
-
-
-
-
- - letter-3A.docx - -
- - letter-3B.docx - -
- - letter-3C.docx - -
- - letter-3D.docx - -
-
- -
-
- letter-1
-
-
-
+
+ Projects
+
+
-
+
- + project-1.docx + +
- + project-2.docx + +
-
+
+ project-3
+
+
-
+
- + project-3A.docx + +
- + project-3B.docx + +
- + project-3C.docx + +
+ - + project-4.docx + +
-
+
+ project-5
+
+
-
+
- + project-5A.docx + +
- + project-5B.docx + +
- + project-5C.docx + +
- + project-5D.docx + +
- + project-5E.docx + +
- + project-5F.docx + +
+
+ -
+
+ Reports
+
+
-
+
-
+
+ report-1
+
+
-
+
- + report-1A.docx + +
- + report-1B.docx + +
- + report-1C.docx + +
+ -
+
+ report-2
+
+
-
+
- + report-2A.docx + +
- + report-2B.docx + +
- + report-2C.docx + +
- + report-2D.docx + +
+ -
+
+ report-3
+
+
-
+
- + report-3A.docx + +
- + report-3B.docx + +
- + report-3C.docx + +
- + report-3D.docx + +
+
+ -
+
+ report-1
+
+
-
+
+ Letters
+
+
-
+
-
+
+ letter-1
+
+
-
+
- + letter-1A.docx + +
- + letter-1B.docx + +
- + letter-1C.docx + +
+ -
+
+ letter-2
+
+
-
+
- + letter-2A.docx + +
- + letter-2B.docx + +
- + letter-2C.docx + +
- + letter-2D.docx + +
+ -
+
+ letter-3
+
+
-
+
- + letter-3A.docx + +
- + letter-3B.docx + +
- + letter-3C.docx + +
- + letter-3D.docx + +
+
+ -
+
+ letter-1
+
+
Example
-File Viewer
--
-
My Documents
+-
+
File Viewer
Accessibility Features
- To make the focus indicator easier to see, nodes in the tree have a custom focus and hover styling created using CSS focus and hover pseudo-classes. + To make the focus indicator easier to see, nodes in the tree have custom focus and hover styling created using CSS focus and hover pseudo-classes.
Terms Used to Describe Trees
Keyboard Support
++ Note that in this example, selection and focus are distinct; moving focus does not change which node is selected. + Because selection does not follow focus, keyboard and screen reader users can navigate and explore the tree without changing the content of the file viewer. + To learn more about this aspect of the design, read the guidance section about Deciding When to Make Selection Automatically Follow Focus. +
Enter or Space |
-
-
|
+ |||
---|---|---|---|---|
Enter | +Performs the default action, which is to select the node, causing the name of the node to appear in the File or Folder Selectedtextbox. |
+ |||
Space | +Performs the default action, which is to select the node, causing the name of the node to appear in the File or Folder Selectedtextbox. |
|||
Down arrow | @@ -552,7 +605,7 @@||||
- | aria-labelledby="IDREF" |
+ aria-labelledby="ID_REFERENCE" |
ul |
Refers to the heading element that contains the label that identifies the purpose of the tree . |
- | tabindex="-1" |
+ tabindex="-1" |
li |
Role, Property, State, and Tabindex Attributes |
- | tabindex="0" |
+ tabindex="0" |
li |
|
- | aria-expanded="false" |
+ aria-expanded="false" |
li |
Role, Property, State, and Tabindex Attributes |
- | aria-expanded="true" |
+ aria-expanded="true" |
li |
Role, Property, State, and Tabindex Attributes |
+ | aria-selected="false" |
+ li |
+
+
|
+ |
+ | aria-selected="true" |
+ li |
+
+
|
+ |
- | aria-setsize="number" |
+ aria-setsize="number" |
li |
Defines the number of treeitem elements in the set of treeitem elements that are in the same branch and at the same level within the hierarchy. |
- | aria-posinset="number" |
+ aria-posinset="number" |
li |
Role, Property, State, and Tabindex Attributes |
- | aria-level="number" |
+ aria-level="number" |
li |
|
Javascript and CSS Source Code
-
@@ -686,7 +761,6 @@
HTML Source Code
-