|
| 1 | +{% renderInstallation %} {% endrenderInstallation %} |
| 2 | + |
| 3 | +<script type="module"> |
| 4 | +import '@patternfly/elements/pf-search-input/pf-search-input.js'; |
| 5 | +</script> |
| 6 | + |
| 7 | +{% renderOverview %} |
| 8 | + <pf-search-input> |
| 9 | + <pf-option>Blue</pf-option> |
| 10 | + <pf-option>Black</pf-option> |
| 11 | + <pf-option>Brown</pf-option> |
| 12 | + <pf-option>Bronze</pf-option> |
| 13 | + <pf-option>Green</pf-option> |
| 14 | + <pf-option>Magenta</pf-option> |
| 15 | + <pf-option>Orange</pf-option> |
| 16 | + <pf-option>Purple</pf-option> |
| 17 | + <pf-option>Periwinkle</pf-option> |
| 18 | + <pf-option>Pink</pf-option> |
| 19 | + <pf-option>Red</pf-option> |
| 20 | + <pf-option>Yellow</pf-option> |
| 21 | + </pf-search-input> |
| 22 | +{% endrenderOverview %} |
| 23 | + |
| 24 | +{% band header="Usage" %} |
| 25 | + |
| 26 | +#### Search Input |
| 27 | + |
| 28 | +{% htmlexample %} |
| 29 | + {% renderFile "./elements/pf-search-input/demo/pf-search-input.html" %} |
| 30 | +{% endhtmlexample %} |
| 31 | + |
| 32 | +#### Search Input Form |
| 33 | +{% htmlexample %} |
| 34 | + {% renderFile "./elements/pf-search-input/demo/pf-search-input-with-submit.html" %} |
| 35 | +{% endhtmlexample %} |
| 36 | + |
| 37 | +#### Disabled |
| 38 | +{% htmlexample %} |
| 39 | + {% renderFile "./elements/pf-search-input/demo/disabled.html" %} |
| 40 | +{% endhtmlexample %} |
| 41 | + |
| 42 | +{% endband %} |
| 43 | + |
| 44 | +{% band header="Accessibility" %} |
| 45 | + |
| 46 | +The search input uses the [Combobox Pattern](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/) recommendations from the WAI ARIA [Authoring Best Practices Guide (APG)](https://www.w3.org/WAI/ARIA/apg). |
| 47 | + |
| 48 | +When the dropdown is disabled it follows [WAI ARIA focusability recommendations](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#focusabilityofdisabledcontrols) for composite widget elements, where dropdown items are still focusable even when the dropdown is disabled. |
| 49 | + |
| 50 | +#### Toggle and typeahead input |
| 51 | + |
| 52 | +When focus is on the toggle, the following keyboard interactions apply: |
| 53 | + |
| 54 | +| Key | Function | |
| 55 | +| ---------------------- | -------------------------------------------------------------------------------------- | |
| 56 | +| <kbd>Down Arrow</kbd> | Opens the listbox and moves focus to the first listbox item. | |
| 57 | +| <kbd>Tab</kbd> | Moves focus to the close button if visible; otherwise, moves to the next focusable element, then closes the listbox.| |
| 58 | +| <kbd>Shift + Tab</kbd> | Moves focus out of element onto the previous focusable item and closes listbox. | |
| 59 | + |
| 60 | +#### Listbox options |
| 61 | + |
| 62 | +Listbox options use the [APG's Roving tabindex](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex) recommendation. When focus is on the listbox, the following keyboard interactions apply: |
| 63 | + |
| 64 | +| Key | Function | |
| 65 | +| ---------------------- | ------------------------------------------------------------------------------------- | |
| 66 | +| <kbd>Enter</kbd> | Selects the options and closes the listbox. | |
| 67 | +| <kbd>Space</kbd> | Selects the options and closes the listbox. | |
| 68 | +| <kbd>Tab</kbd> | Moves focus out of element onto the next focusable options and closes listbox. | |
| 69 | +| <kbd>Shift + Tab</kbd> | Moves focus to the toggle button and closes listbox. | |
| 70 | +| <kbd>Up Arrow</kbd> | Moves focus to the previous option, optionally wrapping from the first to the last. | |
| 71 | +| <kbd>Down Arrow</kbd> | Moves focus to the next option, optionally wrapping from the last to the first. | |
| 72 | +| <kbd>Left Arrow</kbd> | Returns focus to the combobox without closing the popup and moves the input cursor one character to the left. If the input cursor is on the left-most character, the cursor does not move. | |
| 73 | +| <kbd>Right Arrow</kbd> | Returns focus to the combobox without closing the popup and moves the input cursor one character to the right. If the input cursor is on the right-most character, the cursor does not move. | |
| 74 | +| <kbd>Escape</kbd> | Close the listbox that contains focus and return focus to the input. | |
| 75 | +| <kbd>Any letter</kbd> | Navigates to the next option that starts with the letter. | |
| 76 | + |
| 77 | +{% endband %} |
| 78 | + |
| 79 | +{% renderSlots for="pf-search-input", header="Slots on `pf-search-input`" %}{% endrenderSlots %} |
| 80 | +{% renderAttributes for="pf-search-input", header="Attributes on `pf-search-input`" %}{% endrenderAttributes %} |
| 81 | +{% renderMethods for="pf-search-input", header="Methods on `pf-search-input`" %}{% endrenderMethods %} |
| 82 | +{% renderEvents for="pf-search-input", header="Events on `pf-search-input`" %}{% endrenderEvents %} |
| 83 | +{% renderCssCustomProperties for="pf-search-input", header="CSS Custom Properties on `pf-search-input`" %}{% endrenderCssCustomProperties %} |
| 84 | +{% renderCssParts for="pf-search-input", header="CSS Parts on `pf-search-input`" %}{% endrenderCssParts %} |
| 85 | + |
| 86 | +{% renderSlots for="pf-option", header="Slots on `pf-option`" %}{% endrenderSlots %} |
| 87 | +{% renderAttributes for="pf-option", header="Attributes on `pf-option`" %}{% endrenderAttributes %} |
| 88 | +{% renderMethods for="pf-option", header="Methods on `pf-option`" %}{% endrenderMethods %} |
| 89 | +{% renderEvents for="pf-option", header="Events on `pf-option`" %}{% endrenderEvents %} |
| 90 | +{% renderCssCustomProperties for="pf-option", header="CSS Custom Properties on `pf-option`" %}{% endrenderCssCustomProperties %} |
| 91 | +{% renderCssParts for="pf-option", header="CSS Parts on `pf-option`" %}{% endrenderCssParts %} |
0 commit comments