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

Combobox with a Read Only Input #1330

Closed
shleewhite opened this issue Feb 14, 2020 · 7 comments
Closed

Combobox with a Read Only Input #1330

shleewhite opened this issue Feb 14, 2020 · 7 comments
Labels
duplicate An issue closed because it is equivalent to another issue

Comments

@shleewhite
Copy link

There should be an option to have a combobox where a user can select an item, but not type in the input. This mimics the behavior of an HTML Select, but allows flexibility to style the listbox (currently, you cannot override the default HTML select styles).

Examples:

My main question is: How do we communicate that the user cannot type, but that they can select an option?

@sinabahram
Copy link

sinabahram commented Feb 14, 2020 via email

@SiTaggart
Copy link

Given that the default role of a select is Combobox, which aren’t read only, I’ve always wondered why the role of Combobox on its own isn’t good enough as it entirely mimics the native control.

The aria-autocomplete property adds additional information needed to communicate you can type into the field, so the lack of autocomplete should be fine as the default, with no read only property.

You can prevent the typing in the input with JavaScript, and hook into the event still to perform the behavior that @sinabahram mentions.

@shleewhite
Copy link
Author

@SiTaggart But it feels weird to prevent users from typing in the input with JavaScript... But if this is the preferred pattern can an example be added to the ARIA Authoring Practices? Just so that the pattern is documented.

@smhigley
Copy link
Contributor

I tested multiple variations of exactly this pattern last year in a usability study (and did straightforward AT support testing). I think we should implement this with role="combobox" on a <div> element, not an <input readonly>. I agree with @sinabahram about implementing typing to autoselect options.

More here, with sample implementations: https://www.24a11y.com/2019/select-your-poison-part-2/

@carmacleod
Copy link
Contributor

Possible dup of #1026 ?

@mcking65
Copy link
Contributor

@smhigley commented:

I tested multiple variations of exactly this pattern last year in a usability study (and did straightforward AT support testing). I think we should implement this with role="combobox" on a <div> element, not an <input readonly>.

100% agree. We could also consider using a button instead of a div.

I agree with @sinabahram about implementing typing to autoselect options.

Mee too!

@mcking65 mcking65 added the duplicate An issue closed because it is equivalent to another issue label Feb 16, 2020
@mcking65
Copy link
Contributor

@carmacleod wrote:

Possible dup of #1026 ?

Yes, duplicate. Closing and will reference with a description of discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate An issue closed because it is equivalent to another issue
Projects
None yet
Development

No branches or pull requests

6 participants