Skip to content

Commit 0333d28

Browse files
committed
chore: updated documentation
1 parent dac2e45 commit 0333d28

File tree

3 files changed

+60
-4
lines changed

3 files changed

+60
-4
lines changed

elements/pf-search-input/docs/pf-search-input.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,52 @@ import '@patternfly/elements/pf-search-input/pf-search-input.js';
3434
{% renderFile "./elements/pf-search-input/demo/pf-search-input-with-submit.html" %}
3535
{% endhtmlexample %}
3636

37+
#### Disabled
38+
{% htmlexample %}
39+
{% renderFile "./elements/pf-search-input/demo/disabled.html" %}
40+
{% endhtmlexample %}
41+
3742
{% endband %}
3843

44+
{% band header="Accessibility" %}
45+
46+
The select 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 out of element onto the next focusable item and closes 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> | Moves focus to the previous option, optionally wrapping from the first to the last. |
73+
| <kbd>Right Arrow</kbd> | Moves focus to the next option, optionally wrapping from the last to the first. |
74+
| <kbd>Home</kbd> | Moves focus to the first option in the current listbox. |
75+
| <kbd>Escape</kbd> | Close the listbox that contains focus and return focus to the toggle button. |
76+
| <kbd>Any letter</kbd> | Navigates to the next option that starts with the letter. |
77+
78+
{% endband %}
79+
80+
81+
82+
3983
{% renderSlots %}{% endrenderSlots %}
4084

4185
{% renderAttributes %}{% endrenderAttributes %}

elements/pf-search-input/pf-search-input.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@
8989
}
9090

9191
:host([aria-disabled="true"]) {
92-
pointer-events: none !important;
93-
cursor: not-allowed !important;
92+
pointer-events: none;
93+
cursor: not-allowed;
9494
}
9595

9696
#outer.disabled {
97-
color: var(--pf-global--Color--dark-200, #6a6e73) !important;
97+
color: var(--pf-global--Color--dark-200, #6a6e73);
9898
}
9999

100100
#outer {

elements/pf-search-input/pf-search-input.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ export class PfSearchInput extends LitElement {
185185
instance._onOutsideClick(event);
186186
}
187187
});
188+
document.addEventListener('focusout', () => {
189+
for (const instance of PfSearchInput.instances) {
190+
instance._onFocusOut();
191+
}
192+
});
188193
}
189194
}
190195

@@ -198,7 +203,7 @@ export class PfSearchInput extends LitElement {
198203
PfSearchInput.instances.delete(this);
199204
}
200205

201-
// Function to handle the closing of popover
206+
// Function to handle the closing of popover on outside click
202207
@bound private _onOutsideClick(event: MouseEvent) {
203208
const path = event.composedPath();
204209
if (!path.includes(this._searchInputContainer)) {
@@ -208,6 +213,13 @@ export class PfSearchInput extends LitElement {
208213
}
209214
}
210215

216+
// Function to handle the closing of popover on focus out
217+
@bound private _onFocusOut() {
218+
if (this.expanded) {
219+
this.expanded = false;
220+
}
221+
}
222+
211223
/**
212224
* Single select option value for single select menus,
213225
* or array of select option values for multi select.

0 commit comments

Comments
 (0)