Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VCC-2970 VCC-2968 Add a select-only variant; add additional keyboard interaction #22

Merged
merged 10 commits into from
Apr 9, 2024

Conversation

stephymiehle
Copy link

When the text input is deactivated, the combobox works like a <select>.

The input is replaced with a div, then all of the appropriate interactions and attributes are added to the div. Notably, this also brings a lot of select-specific behavior to the div.

Even though the text input is not visible, we still have to use familiar keyboard patterns; see https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/#kbd_label

Stephy Miehle added 3 commits April 2, 2024 17:02
…interaction

The input is replaced with a `div`, then all of the appropriate interactions and attributes are added to the `div`.

Notably, this also brings a lot of `select`-specific behavior to the `div`. Even though the text input is disabled and not visible, we still have to use familiar patterns.
Stephy Miehle added 2 commits April 5, 2024 13:01
…he select/input

When a `<select>` has a paired label (the `<label>`'s for matches the `id` on the `<select>`) or there is a `<label>` directly before a `<select>`, update the `for` to match the `id` of the combobox element
Copy link

@Farsad Farsad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stephymiehle Thank you for the update.

I encountered two issues during testing. Firstly, when multiselection is enabled, the text for selected items wraps.
Screenshot 2024-04-08 at 09 00 38

Secondly, there is an error when using ESC to close the dropdown.
Screenshot 2024-04-08 at 09 00 57

Also, If the Combobo is initialized on the HTML without a select element, no data will be posted on form submission. Would it be possible to keep the input and change it to a hidden input?

Additionally, I suggest renaming the 'selectOnly' configuration to something more clear, such as 'noInput'.

@stephymiehle
Copy link
Author

Thanks @Farsad! Those issues are updated. Now that we're retaining a hidden <input> for form submissions, I'm not sure that "noInput" would be a good fit either.

I came across the "Select-Only" terminology from the W3C.

In another discussion on W3C, this was first called a "read-only combobox" and changed to "select-only" because readonly typically means something different.

I've seen this terminology used from other accessibility bloggers and developers, but usually in reference to the W3C example.

I agree that it's a funny fit when we are adding <select>-initialized comboboxes too, but haven't seen another term commonly used.

@stephymiehle stephymiehle requested a review from Farsad April 9, 2024 03:45
Stephy Miehle and others added 3 commits April 9, 2024 09:20
@stephymiehle stephymiehle merged commit 01f81bc into master Apr 9, 2024
@stephymiehle stephymiehle deleted the vcc-2970/select-only-combobox branch April 9, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants