Improve .form-group accessibility#1028
Merged
simurai merged 2 commits intorelease-14.3.0from Mar 24, 2020
Merged
Conversation
|
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/primer/primer-css/q3v2t0610 |
jonrohan
approved these changes
Feb 24, 2020
muan
reviewed
Mar 9, 2020
Co-Authored-By: Mu-An 慕安 <me@muanchiou.com>
This was referenced Dec 19, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a first attempt to make our
.form-groupcomponent more accessible.Problem
In our docs we suggest using a "definition list" (
<dl>) for the.form-groupcomponent. We even "bake it in" and make it a requirement by using selectors likedl.form-group > dd. The problem is that it can be "too noisy" for screen readers when there is a<dt>with just one<dd>.Fix
This PR replaces...
<dl class="form-group">👉<div class="form-group"><dt>👉<div class="form-group-header"><dd>👉<div class="form-group-body">in the docs.
Before
After
For now, the CSS selectors e.g
dl.form-group > ddare unchanged. We'll have to wait to deprecate them until the next major release. Also, first we'd have to replace all the markup everywhere on dotcom.Alternative
We might not even need those "wrapper" elements and could reduce the markup down to:
It would probably require some more testing and maybe refactoring on dotcom? 🤔
/cc @primer/ds-core