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

Provide accessible error messages for AT users #959

Closed
2 tasks done
dmstern opened this issue Jun 20, 2018 · 2 comments · Fixed by #3380
Closed
2 tasks done

Provide accessible error messages for AT users #959

dmstern opened this issue Jun 20, 2018 · 2 comments · Fixed by #3380

Comments

@dmstern
Copy link

dmstern commented Jun 20, 2018

Prerequisites

  • I have read the documentation;
  • In the case of a bug report, I understand that providing a SSCCE example is tremendously useful to the maintainers.

Description

In order to providy more accessibility to our screen reaser users, we would like to add an aria-describedby-attribute to input fields that reference the inline error message (e.g. "is a required property") with an id of this error meesage when validating the form. This would cause the AT to read out the error message under the input field when the user tabs through the form elements.

Is there a way to configure aria-describedby-attributes and to enable ids to error messages?

Any other ideas to solve this problem are appreciated. :)

For example, instead of this markup from the live playground

<div class="form-group field field-string field-error has-error has-danger">
  <label class="control-label" for="root_lastName">Last name*</label>
  <div></div>
  <input type="text" 
     class="form-control" 
     value="" 
     id="root_lastName" 
     label="Last name" 
     required="" 
     placeholder="">
  <div>
    <p></p>
    <ul class="error-detail bs-callout bs-callout-info">
      <li class="text-danger">is a required property</li>
    </ul>
  </div>
  <div></div>
</div>

it should look like this:

<div class="form-group field field-string field-error has-error has-danger">
  <label class="control-label" for="root_lastName">Last name*</label>
  <div></div>
  <input type="text" 
     class="form-control" 
     value="" 
     id="root_lastName" 
     label="Last name" 
     required="" 
     placeholder="" 
<!-- CHANGE -->
     aria-describedby="error-message-123456789" 
<!-- /CHANGE -->
     >
  <div>
    <p></p>
    <ul class="error-detail bs-callout bs-callout-info">
      <li class="text-danger" 
<!-- CHANGE -->
          id="error-message-123456789"
<!-- /CHANGE -->
          >is a required property</li>
    </ul>
  </div>
  <div></div>
</div>

Steps to Reproduce

  1. Install a screen reader like NVDA
  2. Launch the screen reader
  3. Open the live playground in your browser (The first input field ('First Name') should be focused)
  4. Use the TAB key to navigate to the required 'Last Name'-input-field.
  5. Delete the value --> The field gets red and a message appears below the input field ('is a required property')
  6. Listen to the screen reader.

Expected behavior

The screen reader should read out also the message that is configured here ("is a required property").

Actual behavior

The screen reader tells you that this field is required and should be filled, since it recognizes the HTML5 validation functionality of the browser. But the message is not being read out.

@stale
Copy link

stale bot commented Apr 27, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.

@stale stale bot added the wontfix label Apr 27, 2022
@stale stale bot closed this as completed May 11, 2022
@epicfaace
Copy link
Member

This is important, we should do this

@epicfaace epicfaace reopened this May 12, 2022
@stale stale bot closed this as completed May 26, 2022
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Jan 15, 2023
Fixes rjsf-team#959 by reimplementing rjsf-team#2386 making it consistent across all themes

- In `@rjsf/utils`, added new `descriptionId()`, `errorId()`, `helpId()`, `titleId()` and `ariaDescribedByIds()` functions with unit tests
- In all themes:
  - Updated the `FieldErrorTemplate` to use the `errorId()` function to generate its id
  - Updated the `FieldHelpTemplate` to use the `helpId()` function to generate its id
  - Updated the `ObjectFieldTemplate` to use the `titleId()` and `descriptionId()` functions to generate the ids for the `TitleFieldTemplate` and `DescriptionFieldTemplate` respectively
  - Updated the `BaseInputTemplate` to pass the `ariaDescribedByIds()` value to `aria-describedby` on the "input" component
  - For all the widgets that generated a user-accessible "input", passed in the `ariaDescribedByIds()` call into the `aria-describedby` on the "input" component
- Updated all the test snapshots to update the `title` and `description` ids to the new values and to add the new `aria-describeby` properties
- Updated the documentation to indicate the existance of these new functions
- Updated the `5.x migration guide` to document the potential change of ids for Title, Description and `RadioWidget` and `CheckboxWidget`
- Updated the `CHANGELOG.md` accordingly
@stale stale bot removed the wontfix label Jan 15, 2023
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Jan 15, 2023
Fixes rjsf-team#959 by reimplementing rjsf-team#2386 making it consistent across all themes

- In `@rjsf/utils`, added new `descriptionId()`, `errorId()`, `helpId()`, `titleId()` and `ariaDescribedByIds()` functions with unit tests
- In all themes:
  - Updated the `FieldErrorTemplate` to use the `errorId()` function to generate its id
  - Updated the `FieldHelpTemplate` to use the `helpId()` function to generate its id
  - Updated the `ObjectFieldTemplate` to use the `titleId()` and `descriptionId()` functions to generate the ids for the `TitleFieldTemplate` and `DescriptionFieldTemplate` respectively
  - Updated the `BaseInputTemplate` to pass the `ariaDescribedByIds()` value to `aria-describedby` on the "input" component
  - For all the widgets that generated a user-accessible "input", passed in the `ariaDescribedByIds()` call into the `aria-describedby` on the "input" component
- Updated all the test snapshots to update the `title` and `description` ids to the new values and to add the new `aria-describeby` properties
- Updated the documentation to indicate the existance of these new functions
- Updated the `5.x migration guide` to document the potential change of ids for Title, Description and `RadioWidget` and `CheckboxWidget`
  - Also fixed the incorrectly named `__error` to be `__errors` in the `ErrorSchema` examples
- Updated the `CHANGELOG.md` accordingly
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Jan 15, 2023
Fixes rjsf-team#959 by reimplementing rjsf-team#2386 making it consistent across all themes

- In `@rjsf/utils`, added new `descriptionId()`, `errorId()`, `helpId()`, `titleId()` and `ariaDescribedByIds()` functions with unit tests
- In all themes:
  - Updated the `FieldErrorTemplate` to use the `errorId()` function to generate its id
  - Updated the `FieldHelpTemplate` to use the `helpId()` function to generate its id
  - Updated the `ObjectFieldTemplate` to use the `titleId()` and `descriptionId()` functions to generate the ids for the `TitleFieldTemplate` and `DescriptionFieldTemplate` respectively
  - Updated the `BaseInputTemplate` to pass the `ariaDescribedByIds()` value to `aria-describedby` on the "input" component
  - For all the widgets that generated a user-accessible "input", passed in the `ariaDescribedByIds()` call into the `aria-describedby` on the "input" component
- Updated all the test snapshots to update the `title` and `description` ids to the new values and to add the new `aria-describeby` properties
- Updated the documentation to indicate the existance of these new functions
- Updated the `5.x migration guide` to document the potential change of ids for Title, Description and `RadioWidget` and `CheckboxWidget`
  - Also fixed the incorrectly named `__error` to be `__errors` in the `ErrorSchema` examples
- Updated the `CHANGELOG.md` accordingly
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Jan 15, 2023
Fixes rjsf-team#959 by reimplementing rjsf-team#2386 making it consistent across all themes

- In `@rjsf/utils`, added new `descriptionId()`, `errorId()`, `helpId()`, `titleId()` and `ariaDescribedByIds()` functions with unit tests
- In all themes:
  - Updated the `FieldErrorTemplate` to use the `errorId()` function to generate its id
  - Updated the `FieldHelpTemplate` to use the `helpId()` function to generate its id
  - Updated the `ObjectFieldTemplate` to use the `titleId()` and `descriptionId()` functions to generate the ids for the `TitleFieldTemplate` and `DescriptionFieldTemplate` respectively
  - Updated the `BaseInputTemplate` to pass the `ariaDescribedByIds()` value to `aria-describedby` on the "input" component
  - For all the widgets that generated a user-accessible "input", passed in the `ariaDescribedByIds()` call into the `aria-describedby` on the "input" component
- Updated all the test snapshots to update the `title` and `description` ids to the new values and to add the new `aria-describeby` properties
- Updated the documentation to indicate the existance of these new functions
- Updated the `5.x migration guide` to document the potential change of ids for Title, Description and `RadioWidget` and `CheckboxWidget`
  - Also fixed the incorrectly named `__error` to be `__errors` in the `ErrorSchema` examples
- Updated the `CHANGELOG.md` accordingly
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Jan 15, 2023
Fixes rjsf-team#959 by reimplementing rjsf-team#2386 making it consistent across all themes

- In `@rjsf/utils`, added new `descriptionId()`, `errorId()`, `helpId()`, `titleId()` and `ariaDescribedByIds()` functions with unit tests
- In all themes:
  - Updated the `FieldErrorTemplate` to use the `errorId()` function to generate its id
  - Updated the `FieldHelpTemplate` to use the `helpId()` function to generate its id
  - Updated the `ObjectFieldTemplate` to use the `titleId()` and `descriptionId()` functions to generate the ids for the `TitleFieldTemplate` and `DescriptionFieldTemplate` respectively
  - Updated the `BaseInputTemplate` to pass the `ariaDescribedByIds()` value to `aria-describedby` on the "input" component
  - For all the widgets that generated a user-accessible "input", passed in the `ariaDescribedByIds()` call into the `aria-describedby` on the "input" component
- Updated all the test snapshots to update the `title` and `description` ids to the new values and to add the new `aria-describeby` properties
- Updated the documentation to indicate the existance of these new functions
- Updated the `5.x migration guide` to document the potential change of ids for Title, Description and `RadioWidget` and `CheckboxWidget`
  - Also fixed the incorrectly named `__error` to be `__errors` in the `ErrorSchema` examples
- Updated the `CHANGELOG.md` accordingly
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Jan 16, 2023
Fixes rjsf-team#959 by reimplementing rjsf-team#2386 making it consistent across all themes

- In `@rjsf/utils`, added new `descriptionId()`, `errorId()`, `helpId()`, `titleId()` and `ariaDescribedByIds()` functions with unit tests
- In all themes:
  - Updated the `FieldErrorTemplate` to use the `errorId()` function to generate its id
  - Updated the `FieldHelpTemplate` to use the `helpId()` function to generate its id
  - Updated the `ObjectFieldTemplate` to use the `titleId()` and `descriptionId()` functions to generate the ids for the `TitleFieldTemplate` and `DescriptionFieldTemplate` respectively
  - Updated the `BaseInputTemplate` to pass the `ariaDescribedByIds()` value to `aria-describedby` on the "input" component
  - For all the widgets that generated a user-accessible "input", passed in the `ariaDescribedByIds()` call into the `aria-describedby` on the "input" component
- Updated all the test snapshots to update the `title` and `description` ids to the new values and to add the new `aria-describeby` properties
- Updated the documentation to indicate the existance of these new functions
- Updated the `5.x migration guide` to document the potential change of ids for Title, Description and `RadioWidget` and `CheckboxWidget`
  - Also fixed the incorrectly named `__error` to be `__errors` in the `ErrorSchema` examples
- Updated the `CHANGELOG.md` accordingly
heath-freenome added a commit that referenced this issue Jan 16, 2023
…ts (#3380)

* fix: reimplement 2386 to add aria-describedby elements onto all inputs
Fixes #959 by reimplementing #2386 making it consistent across all themes

- In `@rjsf/utils`, added new `descriptionId()`, `errorId()`, `helpId()`, `titleId()` and `ariaDescribedByIds()` functions with unit tests
- In all themes:
  - Updated the `FieldErrorTemplate` to use the `errorId()` function to generate its id
  - Updated the `FieldHelpTemplate` to use the `helpId()` function to generate its id
  - Updated the `ObjectFieldTemplate` to use the `titleId()` and `descriptionId()` functions to generate the ids for the `TitleFieldTemplate` and `DescriptionFieldTemplate` respectively
  - Updated the `BaseInputTemplate` to pass the `ariaDescribedByIds()` value to `aria-describedby` on the "input" component
  - For all the widgets that generated a user-accessible "input", passed in the `ariaDescribedByIds()` call into the `aria-describedby` on the "input" component
- Updated all the test snapshots to update the `title` and `description` ids to the new values and to add the new `aria-describeby` properties
- Updated the documentation to indicate the existance of these new functions
- Updated the `5.x migration guide` to document the potential change of ids for Title, Description and `RadioWidget` and `CheckboxWidget`
  - Also fixed the incorrectly named `__error` to be `__errors` in the `ErrorSchema` examples
- Updated the `CHANGELOG.md` accordingly

* - Fix test snapshot

* - Responded to reviewer feedback by adding and using `optionId()` and `examplesId()`
  - Added an optional flag to `ariaDescribedByIds()` that, if true, appends the examples id onto the string

* - Minor tweak to the `5.x migration guide`
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this issue Jun 8, 2023
… all inputs (rjsf-team#3380)

* fix: reimplement 2386 to add aria-describedby elements onto all inputs
Fixes rjsf-team#959 by reimplementing rjsf-team#2386 making it consistent across all themes

- In `@rjsf/utils`, added new `descriptionId()`, `errorId()`, `helpId()`, `titleId()` and `ariaDescribedByIds()` functions with unit tests
- In all themes:
  - Updated the `FieldErrorTemplate` to use the `errorId()` function to generate its id
  - Updated the `FieldHelpTemplate` to use the `helpId()` function to generate its id
  - Updated the `ObjectFieldTemplate` to use the `titleId()` and `descriptionId()` functions to generate the ids for the `TitleFieldTemplate` and `DescriptionFieldTemplate` respectively
  - Updated the `BaseInputTemplate` to pass the `ariaDescribedByIds()` value to `aria-describedby` on the "input" component
  - For all the widgets that generated a user-accessible "input", passed in the `ariaDescribedByIds()` call into the `aria-describedby` on the "input" component
- Updated all the test snapshots to update the `title` and `description` ids to the new values and to add the new `aria-describeby` properties
- Updated the documentation to indicate the existance of these new functions
- Updated the `5.x migration guide` to document the potential change of ids for Title, Description and `RadioWidget` and `CheckboxWidget`
  - Also fixed the incorrectly named `__error` to be `__errors` in the `ErrorSchema` examples
- Updated the `CHANGELOG.md` accordingly

* - Fix test snapshot

* - Responded to reviewer feedback by adding and using `optionId()` and `examplesId()`
  - Added an optional flag to `ariaDescribedByIds()` that, if true, appends the examples id onto the string

* - Minor tweak to the `5.x migration guide`
shijistar pushed a commit to shijistar/react-jsonschema-form that referenced this issue Jun 8, 2023
… all inputs (rjsf-team#3380)

* fix: reimplement 2386 to add aria-describedby elements onto all inputs
Fixes rjsf-team#959 by reimplementing rjsf-team#2386 making it consistent across all themes

- In `@rjsf/utils`, added new `descriptionId()`, `errorId()`, `helpId()`, `titleId()` and `ariaDescribedByIds()` functions with unit tests
- In all themes:
  - Updated the `FieldErrorTemplate` to use the `errorId()` function to generate its id
  - Updated the `FieldHelpTemplate` to use the `helpId()` function to generate its id
  - Updated the `ObjectFieldTemplate` to use the `titleId()` and `descriptionId()` functions to generate the ids for the `TitleFieldTemplate` and `DescriptionFieldTemplate` respectively
  - Updated the `BaseInputTemplate` to pass the `ariaDescribedByIds()` value to `aria-describedby` on the "input" component
  - For all the widgets that generated a user-accessible "input", passed in the `ariaDescribedByIds()` call into the `aria-describedby` on the "input" component
- Updated all the test snapshots to update the `title` and `description` ids to the new values and to add the new `aria-describeby` properties
- Updated the documentation to indicate the existance of these new functions
- Updated the `5.x migration guide` to document the potential change of ids for Title, Description and `RadioWidget` and `CheckboxWidget`
  - Also fixed the incorrectly named `__error` to be `__errors` in the `ErrorSchema` examples
- Updated the `CHANGELOG.md` accordingly

* - Fix test snapshot

* - Responded to reviewer feedback by adding and using `optionId()` and `examplesId()`
  - Added an optional flag to `ariaDescribedByIds()` that, if true, appends the examples id onto the string

* - Minor tweak to the `5.x migration guide`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment