orchidjs / tom-select

Tom Select is a lightweight (~16kb gzipped) hybrid of a textbox and select box. Forked from selectize.js to provide a framework agnostic autocomplete widget with native-feeling keyboard navigation. Useful for tagging, contact lists, etc.
https://tom-select.js.org
Apache License 2.0
1.53k stars 111 forks source link

Screen reader not reading selected list when dropdown is closed [Bug]: #697

Open SamiiNodenPoli opened 4 months ago

SamiiNodenPoli commented 4 months ago

Bug description

The screen reader does not read the selected list when focus is removed from the dropdown and remains on the field

Expected behavior

When an item in the dropdown list is selected and then this is collapsed using esc key, the focus moves back to the field and screen reader should read the selected list of items along with the field name when focus is received.

Steps to reproduce

Step 1: When the 'state' combo box receives tab focus, screen reader reads it as “State combo box collapsed has auto complete editable blank”. It reads the name, role, value, and state of the element i.e.,

Name- State Role- Combobox Value- Blank State- collapsed

image

Step 2: When the combo box is expanded, using down arrow key, screen reader announces the list item along with its position out of total items. Ex: “Alabama 1 of 56, Alaska 2 of 56”

image

Step 3: On selecting Alaska, screen reader announces the value selected. “State combo box collapsed has auto complete editable Alaska”

image

Similarly, the expectation from the combo box is for it to read the values selected as shown in Step 3.

Currently, it is reading as “Function combo box collapsed editable opens list Function blank” even though the field, which contains values, is selected.

Suggestion: It should read something like- “Function combo box collapsed editable opens list Selection name selected Selection name selected”

Additional context

All devices

JoackimPennerup commented 3 months ago

What plugins are you using? They differ a lot in how well they handle a11y.

JDCain commented 1 month ago

I see this using the demo example. After an item is selected it always returns the box as blank. I assume this has something to do with how you can keep typing in the box after selecting something, but I don't know enough about how this all works yet to know.

    new TomSelect("#select-beast", {
        create: true,
        sortField: {
            field: "text",
            direction: "asc"
        }
    });
</style>
<select id="select-beast" placeholder="Select a person..." autocomplete="off">
    <option value="">Select a person...</option>
    <option value="4">Thomas Edison</option>
    <option value="1">Nikola</option>
    <option value="3">Nikola Tesla</option>
    <option value="5">Arnold Schwarzenegger</option>
</select>
list
Arnold Schwarzenegger  1 of 4
t
Thomas Edison  1 of 2
h
o
Select a person...  combo box  expanded  editable  opens list  spelling error  tho
list
Thomas Edison  1 of 1
combo box  collapsed  editable  opens list  blank
JDCain commented 1 month ago

If I set controlInput: null then it does read the selection. Is there a way to remove the controlInput once maxItems or something else is hit and then add it back once the item is removed?