Skip to content

aria-required not necessary when native required present #1238

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

Open
wants to merge 1 commit into
base: typo3-v12
Choose a base branch
from

Conversation

MohsinQK
Copy link

Accessibility Note: Use of required vs aria-required (WCAG 2.1)

According to WCAG 2.1, it's important to use the correct attribute to indicate that a form field is required for assistive technologies. Here’s a breakdown of best practices:


required (HTML5 native attribute)

  • Should be used on native form elements like <input>, <select>, and <textarea>.
  • Recognized by modern browsers and assistive technologies (e.g., screen readers).
  • Triggers built-in form validation and provides sufficient accessibility information.
  • No need to add aria-required="true" if required is already present on native elements.

aria-required="true"

  • Used only for custom form controls (e.g., a <div> with role="textbox").
  • Ensures that assistive technologies know the field is required when native HTML validation is not available.
  • Does not trigger browser-native form validation.

🔧 Best Practice

  • Use required for all native HTML5 form elements.
  • Use aria-required="true" only when building custom form components.
  • Avoid adding both required and aria-required="true" to the same native element – it’s redundant.

📘 WCAG 2.1 References

@Teisi
Copy link
Contributor

Teisi commented Jun 3, 2025

#293

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

Successfully merging this pull request may close these issues.

2 participants