guardian / guardian/stand

`Autocomplete` component does not focus on option list box after key strokes

Open
#75 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3
Forks
0
Avg merge
1d 6h
Merged PRs (30d)
42

Description

## Background

When implementing the `TagAutocomplete` component within Composer we encountered a regression in behaviour that we are unable to fix. This was already flagged as an issue on its React migration ([#5422](https://github.com/guardian/flexible-content/pull/5422)) so we have some direct feedback that this would an issue with users of the tool.

This may not be the case for other tools, in which case it may be acceptable to use the component there.

### Expected (first row highlighted/focused):

Image

- after every keystroke that has options in the listbox below, the first element is highlighted/focused

### Actual (no highlight/focus)

Image

- after the first keystroke the first option is highlighted, but after every subsequent keystroke there is no highlight or focus within the listbox

## Notes

This seems to be a deliberate choice by the developers of react-aria, as suggested by [this readme](https://github.com/adobe/react-spectrum/blob/main/packages/dev/docs/pages/blog/building-a-combobox.mdx#nvda).

Initially, our ComboBox would automatically focus the first item in the listbox whenever opened so the user wouldn't have to issue another keypress to begin option navigation. However, when we tested the ComboBox using NVDA we discovered that character deletions and text cursor movement in the ComboBox input weren't being announced at all. NVDA would only resume announcing if no options had virtual focus via aria-activedescendant, so we ended up clearing option focus on any changes to the input text or left/right arrow key presses

There is an open [issue](https://github.com/adobe/react-spectrum/issues/8007) and [PR](https://github.com/adobe/react-spectrum/pull/9189) to resolve this. Maybe in the future this will be solved

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.