Skip to content

Use aria-required instead of required on required form elements - #4023

Merged
mperrotti merged 3 commits into
mainfrom
mp/pref-aria-required
Dec 8, 2023
Merged

Use aria-required instead of required on required form elements#4023
mperrotti merged 3 commits into
mainfrom
mp/pref-aria-required

Conversation

@mperrotti

@mperrottimperrotti commented Dec 5, 2023

Copy link
Copy Markdown
Contributor

Added later by @siddharthkp: Hi 👋 This change was to workaround native browser validation errors. aria-required communicates the same message and was approved by the a11y team 👍.

Closes #

Changelog

New

Changed

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan

Testing & Reviewing

Merge checklist

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@changeset-bot

changeset-botBot commented Dec 5, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1600730

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
NameType
@primer/reactPatch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actionsBot commented Dec 5, 2023

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
dist/browser.esm.js104.82 KB (+0.02% 🔺)
dist/browser.umd.js105.35 KB (+0.01% 🔺)

@mperrotti

Copy link
Copy Markdown
ContributorAuthor

This was opened as a draft PR to address a problem with inputs using HTML5 browser-native validation because of the required attribute being passed to the <input />.

Here are two possible alternatives to these changes:

  • use the invalid event on the input, and call event.preventDefault() in the event handler
  • set the novalidate attribute on the parent form

@mperrotti
mperrotti marked this pull request as ready for review December 7, 2023 21:53
@mperrotti
mperrotti requested review from a team and broccolinisoupDecember 7, 2023 21:53
@mperrotti
mperrotti added this pull request to the merge queueDec 8, 2023
Merged via the queue into main with commit 83c125fDec 8, 2023
@mperrotti
mperrotti deleted the mp/pref-aria-required branch December 8, 2023 17:31
@primerprimerBot mentioned this pull request Dec 8, 2023
TylerJDev pushed a commit that referenced this pull request Dec 11, 2023
…4023)
* sets aria-required attr instead of required
* Create khaki-rules-breathe.md
@primerprimerBot mentioned this pull request Dec 19, 2023
Sign up for freeto 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.

3 participants

@mperrotti@camertron@joshblack