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

Question: HTML term 'Suffering from being missing' explained #7411

Open
LaurenceRLewis opened this issue Dec 13, 2021 · 4 comments
Open

Question: HTML term 'Suffering from being missing' explained #7411

LaurenceRLewis opened this issue Dec 13, 2021 · 4 comments
Labels
clarification Standard could be clearer topic: forms

Comments

@LaurenceRLewis
Copy link

The HTML Spec for Option mentions 'Suffering from being missing'. The description for 'Suffering from being missing' is:

When a control has no value but has a required attribute (input required, textarea required); or, more complicated rules for select elements and controls in radio button groups, as specified in their sections.

I am totally confused by what this actually means.

The term is mentioned in the placeholder-label-option description.

Constraint validation: If the element has its required attribute specified, and either none of the option elements in the select element's list of options have their selectedness set to true, or the only option element in the select element's list of options with its selectedness set to true is the placeholder label option, then the element is suffering from being missing.

I am trying to understand if

  • A placeholder selected by default is valid HTML <option disabled selected>Please select</option>
  • If there is a valid method where the first option is not visible and only becomes visible when the Listbox is expanded using native HTML.
@annevk
Copy link
Member

annevk commented Dec 13, 2021

"Suffering from being missing" is about client-side form validation, it doesn't seem to be related to your problem. I don't think there's anything forbidding disabling and selecting the first option element. You could leave it blank to make it invisible I suppose, although I'm not sure what the AT experience for that would be...

@annevk
Copy link
Member

annevk commented Dec 13, 2021

cc @whatwg/a11y

@annevk annevk added clarification Standard could be clearer topic: forms labels Dec 13, 2021
@LaurenceRLewis
Copy link
Author

@annevk Thanks for the tip on Suffering from being missing relation to client-side validation.

I noticed that leaving the first option empty affects accessibility across browsers and screen readers. On desktop, using Chrome and JAWS 2022 or NVDA, there is a problem with the wrong number of available options announced. I found that adding aria-hidden true fixes this particular issue.

This is more problematic using Voiceover on iOS and TalkBack on Android, because each option is announced as a Button. If an option has no text then it is missing an accessible name.

@annevk
Copy link
Member

annevk commented Dec 13, 2021

Makes sense, I guess that would argue for having <select placeholder> or some such instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer topic: forms
Development

No branches or pull requests

2 participants