diff --git a/docs/docs.css b/docs/docs.css index a38ce5b..4e675ac 100644 --- a/docs/docs.css +++ b/docs/docs.css @@ -116,6 +116,18 @@ button.active { inset -2px -2px #dfdfdf, inset 2px 2px #808080; } +.combo-box.key-nav > input[aria-haspopup] ~ ul > li[aria-selected=true] { + color: #fff; + background-color: #000080; +} + +div.key-nav > ul[role=listbox] > li[aria-current=true], +div.key-nav > ul[role=listbox] > li:hover:not([aria-selected=true]), +div:not(.key-nav) > input[aria-haspopup] ~ ul:has([aria-current=true]) > li[aria-selected=true]:not([aria-current=true]) { + color: inherit; + background-color: inherit; +} + @media (max-width: 480px) { aside { display: none; diff --git a/docs/index.html.ejs b/docs/index.html.ejs index 442af08..3b87093 100644 --- a/docs/index.html.ejs +++ b/docs/index.html.ejs @@ -31,7 +31,8 @@
- A drop-down list box allows the selection of only a - single item from a list. In its closed state, the control displays - the current value for the control. The user opens the list to change - the value. + A combo box combines a text box with a list box. This allows the user to type an entry or choose one from the list. ++ +
+ There are 2 ways you can render a combo box. The first is using a text input, a parent ul, and children li together, wrapped inside a container element with the combo-box class. For accessibility, follow the minimum requirements below:
+
role="combobox" attribute to the text inputrole="listbox" attribute to the ulrole="option" attribute to each liid of the listbox with the aria-controls attribute on the text input
+
+ The second adds a button to toggle the visibility of the drop-down. For accessibility, follow these additional requirements:
+
aria-haspopup="listbox" and aria-expanded attributes to the text input+ For more options of the list box, see the ListBox section. +
++ A list box is a control for displaying a list of choices for the user. + +
- Dropdowns can be rendered by using the select and option
- elements.
+ The simplest way to render a list box is by using the select element with a multiple attribute specified.