{"id":312,"date":"2018-12-10T16:12:33","date_gmt":"2018-12-10T16:12:33","guid":{"rendered":"https:\/\/pressbooks.library.ryerson.ca\/wafd\/?post_type=chapter&#038;p=312"},"modified":"2022-12-16T18:26:52","modified_gmt":"2022-12-16T18:26:52","slug":"keyboard-interaction","status":"publish","type":"chapter","link":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/chapter\/keyboard-interaction\/","title":{"raw":"Keyboard Interaction","rendered":"Keyboard Interaction"},"content":{"raw":"Keyboard access is perhaps the most important accessibility feature that can go into a website, widget, or web application. However, it is often overlooked by developers, who are typically mouse users and may not have keyboard usability as a part of their testing regimen. People who are blind are typically unable to use a mouse, so any feature that relies on a mouse alone to function will likely be inaccessible to them. Fortunately, it is relatively easy to include keyboard access. It\u2019s more a matter of remembering to add it when mouse access is added.\r\n\r\nThe following is a simple example of including both mouse and keyboard events when defining interaction for a widget or web application. Examine the JavaScript to see how mouse and keyboard events are handled, then under the <strong>Result tab<\/strong>, try operating the button with a keyboard and mouse while using ChromeVox. How you go about implementing both mouse and keyboard doesn\u2019t really matter, as long as it is possible to interact with both.\r\n\r\nYou may notice some inconsistencies in ChromeVox support for the live region used to present the messages in the example, more specifically the <code>aria-atomic<\/code> attribute. Live regions will be covered more thoroughly later in this unit.\r\n<div style=\"height: 350px; width: 100%; overflow: hidden;\">[h5p id=\"12\"]<\/div>\r\n<h2>Predictability, Consistency, and Convention<\/h2>\r\nHere we will introduce the basics of keyboard interaction, and we\u2019ll go into greater detail when we start looking more closely at particular widgets and design patterns as they are introduced in the units that follow.\r\n\r\nAs the heading for this section suggests, keyboard interaction needs to be predictable, consistent, and should follow convention. That is, users should have a good idea of the path that the focus will follow (predictable). When navigating with the Tab key, that path should be the same throughout an application or website (consistent). Finally, it should be like it is in other applications, websites, or operating systems (convention).\r\n<div style=\"margin: 1em 0; padding: 1em; border: 1px solid #ddd; border-left: 10px solid #0000ff;\"><strong>Suggested Reading:<\/strong> <a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/practices\/keyboard-interface\/\">Developing a Keyboard Interface<\/a><\/div>\r\nTake for example a combo box (aka, a select menu). Regardless of the operating system being used, combo boxes work the same way. If you are developing a widget out of divs that function like a combo box, it should operate like a standard HTML combo box.\r\n\r\n<strong>Conventional keyboard interaction for a combo box:<\/strong>\r\n<ul>\r\n \t<li>Tab to navigate into the combo box<\/li>\r\n \t<li>While in focus, tab to navigate beyond the combo box<\/li>\r\n \t<li>While in focus, Shift + Tab to navigate before the combo box<\/li>\r\n \t<li>While in focus, Down Arrow to show next option<\/li>\r\n \t<li>While in focus, Up Arrow to show previous option<\/li>\r\n \t<li>While in focus, Alt + Down Arrow to display options list<\/li>\r\n \t<li>While options list is open, Alt + Up Arrow to close the options list<\/li>\r\n \t<li>While options list is open, Esc to close the options list and return to default state<\/li>\r\n \t<li>While an option is in focus, Enter to select that option<\/li>\r\n<\/ul>\r\nWhen developing a custom combobox\u00a0\u2014 typically, a text box and list of options\u00a0\u2014 a grid, a tree, or a dialog are combined into a functional unit that should operate like a standard HTML select menu. Functionality in addition to that described above may be added to the custom combobox, e.g., to add <strong>autocompletion<\/strong>. As the user types letters into the text box, options beginning with the string type are <strong>displayed below as a list<\/strong>\u00a0or the first option with those letters is <strong>displayed inline<\/strong> in the text box.\r\n<div style=\"margin: 1em 0; padding: 1em; border: 1px solid #ddd; border-left: 10px solid #b9f;\">\r\n\r\n<strong>Try This:<\/strong> Using your keyboard, try the keyboard interactions described above to confirm whether or not the combobox functions in a conventional way. Try it with a few different browsers and notice any variations in how different browsers handle combobox interaction.\r\n<div style=\"height: 350px; width: 100%; overflow: hidden;\">[h5p id=\"15\"]<\/div>\r\n<\/div>\r\n<div style=\"margin: 1em 0; padding: 1em; border: 1px solid #ddd; border-left: 10px solid #0000ff;\"><strong>Suggested Reading:<\/strong> For detailed discussion of combobox design patterns, see: <a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/combobox\/\">ARIA Authoring Practices Guide (Combo Boxes)<\/a><\/div>\r\n<div style=\"margin: 1em 0; padding: 1em; border: 1px solid #ddd; border-left: 10px solid #3c3;\">\r\n\r\n<strong>Toolkit:\u00a0<\/strong>For a list of design patterns, and keyboard interaction conventions, review the following widget development best practices. Scan for now. They will be covered more thoroughly in later units.\r\n<ul>\r\n \t<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/combobox\/\">Combobox<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/grid\/\">Grid<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/listbox\/\">Listbox<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/menu\/\">Menu or menu bar<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/radiobutton\/\">Radiogroup<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/tabpanel\/\">Tabs<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/toolbar\/\">Toolbar<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/treeview\/\">Tree View<\/a><\/li>\r\n<\/ul>\r\n<\/div>","rendered":"<p>Keyboard access is perhaps the most important accessibility feature that can go into a website, widget, or web application. However, it is often overlooked by developers, who are typically mouse users and may not have keyboard usability as a part of their testing regimen. People who are blind are typically unable to use a mouse, so any feature that relies on a mouse alone to function will likely be inaccessible to them. Fortunately, it is relatively easy to include keyboard access. It\u2019s more a matter of remembering to add it when mouse access is added.<\/p>\n<p>The following is a simple example of including both mouse and keyboard events when defining interaction for a widget or web application. Examine the JavaScript to see how mouse and keyboard events are handled, then under the <strong>Result tab<\/strong>, try operating the button with a keyboard and mouse while using ChromeVox. How you go about implementing both mouse and keyboard doesn\u2019t really matter, as long as it is possible to interact with both.<\/p>\n<p>You may notice some inconsistencies in ChromeVox support for the live region used to present the messages in the example, more specifically the <code>aria-atomic<\/code> attribute. Live regions will be covered more thoroughly later in this unit.<\/p>\n<div style=\"height: 350px; width: 100%; overflow: hidden;\">\n<div id=\"h5p-12\">\n<div class=\"h5p-content\" data-content-id=\"12\"><\/div>\n<\/div>\n<\/div>\n<h2>Predictability, Consistency, and Convention<\/h2>\n<p>Here we will introduce the basics of keyboard interaction, and we\u2019ll go into greater detail when we start looking more closely at particular widgets and design patterns as they are introduced in the units that follow.<\/p>\n<p>As the heading for this section suggests, keyboard interaction needs to be predictable, consistent, and should follow convention. That is, users should have a good idea of the path that the focus will follow (predictable). When navigating with the Tab key, that path should be the same throughout an application or website (consistent). Finally, it should be like it is in other applications, websites, or operating systems (convention).<\/p>\n<div style=\"margin: 1em 0; padding: 1em; border: 1px solid #ddd; border-left: 10px solid #0000ff;\"><strong>Suggested Reading:<\/strong> <a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/practices\/keyboard-interface\/\">Developing a Keyboard Interface<\/a><\/div>\n<p>Take for example a combo box (aka, a select menu). Regardless of the operating system being used, combo boxes work the same way. If you are developing a widget out of divs that function like a combo box, it should operate like a standard HTML combo box.<\/p>\n<p><strong>Conventional keyboard interaction for a combo box:<\/strong><\/p>\n<ul>\n<li>Tab to navigate into the combo box<\/li>\n<li>While in focus, tab to navigate beyond the combo box<\/li>\n<li>While in focus, Shift + Tab to navigate before the combo box<\/li>\n<li>While in focus, Down Arrow to show next option<\/li>\n<li>While in focus, Up Arrow to show previous option<\/li>\n<li>While in focus, Alt + Down Arrow to display options list<\/li>\n<li>While options list is open, Alt + Up Arrow to close the options list<\/li>\n<li>While options list is open, Esc to close the options list and return to default state<\/li>\n<li>While an option is in focus, Enter to select that option<\/li>\n<\/ul>\n<p>When developing a custom combobox\u00a0\u2014 typically, a text box and list of options\u00a0\u2014 a grid, a tree, or a dialog are combined into a functional unit that should operate like a standard HTML select menu. Functionality in addition to that described above may be added to the custom combobox, e.g., to add <strong>autocompletion<\/strong>. As the user types letters into the text box, options beginning with the string type are <strong>displayed below as a list<\/strong>\u00a0or the first option with those letters is <strong>displayed inline<\/strong> in the text box.<\/p>\n<div style=\"margin: 1em 0; padding: 1em; border: 1px solid #ddd; border-left: 10px solid #b9f;\">\n<p><strong>Try This:<\/strong> Using your keyboard, try the keyboard interactions described above to confirm whether or not the combobox functions in a conventional way. Try it with a few different browsers and notice any variations in how different browsers handle combobox interaction.<\/p>\n<div style=\"height: 350px; width: 100%; overflow: hidden;\">\n<div id=\"h5p-15\">\n<div class=\"h5p-content\" data-content-id=\"15\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div style=\"margin: 1em 0; padding: 1em; border: 1px solid #ddd; border-left: 10px solid #0000ff;\"><strong>Suggested Reading:<\/strong> For detailed discussion of combobox design patterns, see: <a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/combobox\/\">ARIA Authoring Practices Guide (Combo Boxes)<\/a><\/div>\n<div style=\"margin: 1em 0; padding: 1em; border: 1px solid #ddd; border-left: 10px solid #3c3;\">\n<p><strong>Toolkit:\u00a0<\/strong>For a list of design patterns, and keyboard interaction conventions, review the following widget development best practices. Scan for now. They will be covered more thoroughly in later units.<\/p>\n<ul>\n<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/combobox\/\">Combobox<\/a><\/li>\n<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/grid\/\">Grid<\/a><\/li>\n<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/listbox\/\">Listbox<\/a><\/li>\n<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/menu\/\">Menu or menu bar<\/a><\/li>\n<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/radiobutton\/\">Radiogroup<\/a><\/li>\n<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/tabpanel\/\">Tabs<\/a><\/li>\n<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/toolbar\/\">Toolbar<\/a><\/li>\n<li><a href=\"https:\/\/www.w3.org\/WAI\/ARIA\/apg\/patterns\/treeview\/\">Tree View<\/a><\/li>\n<\/ul>\n<\/div>\n","protected":false},"author":100,"menu_order":6,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-312","chapter","type-chapter","status-publish","hentry"],"part":31,"_links":{"self":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/pressbooks\/v2\/chapters\/312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/wp\/v2\/users\/100"}],"version-history":[{"count":30,"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/pressbooks\/v2\/chapters\/312\/revisions"}],"predecessor-version":[{"id":2043,"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/pressbooks\/v2\/chapters\/312\/revisions\/2043"}],"part":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/pressbooks\/v2\/parts\/31"}],"metadata":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/pressbooks\/v2\/chapters\/312\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/wp\/v2\/media?parent=312"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/pressbooks\/v2\/chapter-type?post=312"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/wp\/v2\/contributor?post=312"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/pressbooks.library.torontomu.ca\/wafd\/wp-json\/wp\/v2\/license?post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}