dotnet / Scaffolding

Code generators to speed up development.
MIT License
635 stars 227 forks source link

Blazor CRUD scaffolding should include correct ARIA roles and attributes #2891

Open MackinnonBuck opened 2 months ago

MackinnonBuck commented 2 months ago

Overview

The "Create.razor" template (defined here and here) should generate ARIA roles/attributes for compatibility with screen readers.

There are currently two known accessibility issues with this template:

  1. Screen readers don't announce when a field is required
  2. Screen readers don't announce when a value for a required field is not provided

Proposed fixes

  1. Conditionally add the aria-required="true" HTML attribute here if the associated model property is annotated with a RequiredAttribute
  2. Add role="alert" to the <ValidationSummary /> here

Update: The same changes should also be applied to the Edit page.

mkArtakMSFT commented 2 months ago

Thanks @MackinnonBuck. @vijayrkn this is accessibility related so it has to be fixed by .NET 9 GA. Mackinnon has provided the content above. Can you handle this from here please?

deepchoudhery commented 1 month ago

Yep should be done for .NET 9 GA