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

Allow combobox and spinbutton on input type text #111

Closed
mcking65 opened this issue Jun 26, 2018 · 11 comments
Closed

Allow combobox and spinbutton on input type text #111

mcking65 opened this issue Jun 26, 2018 · 11 comments

Comments

@mcking65
Copy link

For input type text with no list attribute, I see allowed roles are "no role".

It should allow combobox and spinbutton. Input type text is the basis for practically every custom combo and spinbutton .

@stevefaulkner
Copy link
Collaborator

@mcking65 please provide some examples of deployed custom controls so the pattern can be reviewed.

@mcking65
Copy link
Author

google.com

@stevefaulkner
Copy link
Collaborator

@mcking65 that's a good example for combobox how about spinbutton?

@mcking65
Copy link
Author

@mcking65
Copy link
Author

It doesn't seem reasonable that we would justify the allowed roles based on what's being done by other people; it should be based on what is needed to achieve our objectives of utilizing ARIA.

For example, we should also allow role=searchbox on type text ... but you won't find any implementations of that out there ... role searchbox is still as shiney as a new penny.

@stevefaulkner
Copy link
Collaborator

@mcking65 describing use cases without necessary prior art is fine. But simply asserting that "ARIA x should be allowed because we think so" is not. What reason is there to use role=searchbox over type=search?

@mcking65
Copy link
Author

@stevefaulkner, thank you for 20484cd.

What reason is there to use role=searchbox over type=search?

The reason for using a textbox is to get browser support for accessible text. Is there a better way to get that if you are creating a custom searchbox?

I suppose you could use a div with contenteditable and role textbox, but doesn't that force the developer into a more complex box?

Should I open another issue for the searchbox role?

@stevefaulkner
Copy link
Collaborator

stevefaulkner commented Jun 26, 2018

@mcking65 I suggest you could use
<input type="search" role="searchbox">

In all evergreen browsers input type=search is conveyed via accessibility APIs but not all AT have support, it falls back to input type=text in browsers without support. There is no visual/behavioral difference between type=text and type=search. addition of role=searchbox fills gaps.

failing that I can look at adding role=searchbox to text input

@jnurthen
Copy link
Member

jnurthen commented Jun 27, 2018

There is no visual/behavioral difference between type=text and type=search

Except in webkit where if I do this I now have to remove the styling.
https://stackoverflow.com/questions/9421551/how-do-i-remove-all-default-webkit-search-field-styling

@jessebeach
Copy link

@jnurthen exactly, one of the difficult issues with using semantic HTML is the styling and behavior assumptions baked into the elements: For the <input type="search" /> case, the input exposes a "clear" button on hover and focus.

clear-button

In practice, we see developers drifting to non-semantic HTML in order to avoid default agent styling. Sure, this presents additional problems for back-filling behavior, but that can be dealt with as long as I can express the intended semantics of the component via ARIA. If I'm arbitrarily limited because "there's already and HTML5 element that expresses that role", then I'm left with a system of semantic gaps. For instance, we certainly have elements for headings.

<h1>Cats and dogs, what's their deal?</h1>

But if developers at my company chose to use a div instead of h1 some time in the distant past because they didn't want the default heading styling and now I'm tasked with expressing the semantics of the element correctly, I can easily do that:

<div>Cats and dogs, what's their deal?</div>

becomes

<div role="heading" aria-level="1">Cats and dogs, what's their deal?</div>

and I don't need to worry about resetting styles or busting some obscure UI because the CSS specificity played out in a way I hadn't anticipated. We've got tools like eslint-plugin-jsx-a11y to guide developers in best practice. What I'd like to avoid is limitations in how I can use ARIA to override legacy bad practice so that I'm not compelled to take on risk of introducing visual regressions because I'm forced to use semantic HTML elements because an ARIA role is disallowed on an element in arbitrary cases.

@stevefaulkner
Copy link
Collaborator

Fixed by 157130a

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

No branches or pull requests

4 participants