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

Validation feedback/tooltips lack association with their form control #28414

Open
patrickhlauke opened this issue Mar 5, 2019 · 10 comments
Open

Comments

@patrickhlauke
Copy link
Member

patrickhlauke commented Mar 5, 2019

the feedback and tooltip containers need to be programmatically associated with their respective form controls, e.g. using aria-describedby="...", e.g.

<label for="validationTooltip03">City</label>
<input type="text" class="form-control" id="validationTooltip03" ... required>
<div class="invalid-tooltip">
   Please provide a valid city.
</div>

to

<label for="validationTooltip03">City</label>
<input type="text" class="form-control" id="validationTooltip03" aria-descriebedby="validationTooltip03-tip" ... required>
<div class="invalid-tooltip" id="validationTooltip03-tip">
   Please provide a valid city.
</div>
@patrickhlauke patrickhlauke self-assigned this Mar 5, 2019
@patrickhlauke patrickhlauke added this to Inbox in v5 via automation Mar 5, 2019
@danielnixon
Copy link
Contributor

Interesting to note that this is actually a regression from Bootstrap 3 🤔

https://getbootstrap.com/docs/3.4/css/#forms-help-text

Help text should be explicitly associated with the form control it relates to using the aria-describedby attribute. This will ensure that assistive technologies – such as screen readers – will announce this help text when the user focuses or enters the control.

@patrickhlauke
Copy link
Member Author

sure. lots of moving parts to bootstrap, so things often fall between the cracks on large refactors/reworkings.

@patrickhlauke
Copy link
Member Author

patrickhlauke commented Jun 17, 2019

this issue is complicated by the fact that, despite display:none, certain browser/AT combinations will still announce the additional validation text referenced via aria-describedby. so these need to be added dynamically via JS, not as a pure CSS solution. thoughts @mdo ? (i guess as our validation currently isn't pure pure CSS anyway as i think we use script to add was-validated, this is less of a problem though)

@patrickhlauke patrickhlauke changed the title Docs: validation feedback/tooltips lack association with their form control Validation feedback/tooltips lack association with their form control Jun 17, 2019
@patrickhlauke patrickhlauke mentioned this issue Jun 17, 2019
10 tasks
@patrickhlauke
Copy link
Member Author

@mdo i think at this stage we probably can't rely on pure CSS to have both the "just hang off the :valid / :invalid" AND avoiding that validation tooltips get announced right away if we were properly using aria-describedby, as the display:none won't prevent them from being announced. feels like we may need an actual plugin/JavaScript behavior for form validations...thoughts? and if so, any chance of a pointer on how to go about this?

@patrickhlauke
Copy link
Member Author

alternatively i guess we could cram all the extra logic into that example JS snippet we provide, but that feels very dirty, expecting users to manually copy/paste some custom JS in to provide actual core functionality that should be handled directly by BS silently?

@patrickhlauke
Copy link
Member Author

xref #28995 for a first very naive approach

@patrickhlauke
Copy link
Member Author

dropping this here for reference as well https://developer.paciellogroup.com/blog/2015/05/short-note-on-aria-labelledby-and-aria-describedby/

@mdo mdo added this to Inbox in v5.0.0-alpha2 via automation Jun 15, 2020
@mdo mdo removed this from Inbox in v5 Jun 15, 2020
patrickhlauke added a commit that referenced this issue Jun 19, 2020
- paradoxically, due to our current problems with validation (see #28414) and the fact that browsers seem to have improved in this area for the most part, it's now actually better to use browser-native validation
- added explicit `id` and `aria-describedby` association to at least the server-side form error messages, to show how it should be done properly, and expanded the prose for that explaining this.
patrickhlauke added a commit that referenced this issue Jul 3, 2020
- paradoxically, due to our current problems with validation (see #28414) and the fact that browsers seem to have improved in this area for the most part, it's now actually better to use browser-native validation
- added explicit `id` and `aria-describedby` association to at least the server-side form error messages, to show how it should be done properly, and expanded the prose for that explaining this.
patrickhlauke added a commit that referenced this issue Jul 11, 2020
* Expand on disabled fieldsets and faked buttons

include further advice/information on how to disable faked buttons for keyboard/AT users

* Centralise accessible name advice in forms overview

seems odd to only mention (separately) label, aria-label etc in input-group and layout. the advice is just as pertinent in other sections like select. checks only skims over this.

moving this, in expanded form, into the overview section itself. adding a specific cross-reference (just because they are easily left with no accname at all) in the checks page.

* Change warning about accessibility, modify server-side example

- paradoxically, due to our current problems with validation (see #28414) and the fact that browsers seem to have improved in this area for the most part, it's now actually better to use browser-native validation
- added explicit `id` and `aria-describedby` association to at least the server-side form error messages, to show how it should be done properly, and expanded the prose for that explaining this.

* Replace `.sr-only` with `.visually-hidden` in new addition

* Copy edits for clarity in parenthetical

* Copy and formatting tweaks

- Wordsmithing here and there
- Turns some hyphens into em dashes
- Turns a long running comma separated list into an unordered list
- Rearranges some copy just a bit

Co-authored-by: Mark Otto <markd.otto@gmail.com>
@mdo mdo added this to Inbox in v5.0.0-alpha3 via automation Sep 16, 2020
@mdo mdo removed this from Inbox in v5.0.0-alpha2 Sep 16, 2020
@mdo
Copy link
Member

mdo commented Sep 16, 2020

#31677 aims to address this in our form validation pages. Slating for alpha 3!

@mdo mdo moved this from Inbox to Review in v5.0.0-alpha3 Sep 18, 2020
olsza pushed a commit to olsza/bootstrap that referenced this issue Oct 3, 2020
* Expand on disabled fieldsets and faked buttons

include further advice/information on how to disable faked buttons for keyboard/AT users

* Centralise accessible name advice in forms overview

seems odd to only mention (separately) label, aria-label etc in input-group and layout. the advice is just as pertinent in other sections like select. checks only skims over this.

moving this, in expanded form, into the overview section itself. adding a specific cross-reference (just because they are easily left with no accname at all) in the checks page.

* Change warning about accessibility, modify server-side example

- paradoxically, due to our current problems with validation (see twbs#28414) and the fact that browsers seem to have improved in this area for the most part, it's now actually better to use browser-native validation
- added explicit `id` and `aria-describedby` association to at least the server-side form error messages, to show how it should be done properly, and expanded the prose for that explaining this.

* Replace `.sr-only` with `.visually-hidden` in new addition

* Copy edits for clarity in parenthetical

* Copy and formatting tweaks

- Wordsmithing here and there
- Turns some hyphens into em dashes
- Turns a long running comma separated list into an unordered list
- Rearranges some copy just a bit

Co-authored-by: Mark Otto <markd.otto@gmail.com>
@mdo mdo added this to Inbox in v5.0.0-beta1 via automation Oct 26, 2020
@mdo mdo removed this from Review in v5.0.0-alpha3 Oct 26, 2020
@XhmikosR
Copy link
Member

@patrickhlauke @mdo: is this still valid for v5?

@XhmikosR XhmikosR removed this from Inbox in v5.0.0-beta1 Nov 25, 2020
@XhmikosR XhmikosR added this to Inbox in v5.0.0-beta2 via automation Nov 25, 2020
@XhmikosR XhmikosR added this to Inbox in v5.0.0-beta3 via automation Dec 14, 2020
@XhmikosR XhmikosR removed this from Inbox in v5.0.0-beta2 Dec 14, 2020
@patrickhlauke
Copy link
Member Author

sorry, late reply to say yes, it's still a problem we need to tackle...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants