Edit site: Add missing label to post status password protected input field#52885
Edit site: Add missing label to post status password protected input field#52885
Conversation
|
Size Change: +124 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in 90f68c9. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5644898957
|
ntsekouras
left a comment
There was a problem hiding this comment.
Thank you @afercia, this looks good! I left a couple of nits and we can 🚢 .
| ) } | ||
| type="text" | ||
| /> | ||
| <div className="edit-site-change-status__password-input"> |
There was a problem hiding this comment.
We don't use this class name and I don't think we even need a div here. We could replace with a fragment(<></>), no?
There was a problem hiding this comment.
@ntsekouras thanks for your feedback, I added the div and class for consistency with the password field in the post editor, see
These two forms are very similar and I'd tend to think it would be good to reuse the same code. Even better, consider to abstract in a specific component. I'll create a separate issue if no objections.
| id={ `edit-site-change-status__password` } | ||
| label={ __( 'Password' ) } | ||
| > | ||
| <fieldset className="edit-site-change-status__password-fieldset"> |
There was a problem hiding this comment.
This class name can be removed as well.
There was a problem hiding this comment.
Same as above: consistency with the form used in the post editor, see
What?
Follow-up to #52634
In #52634 I missed that the password protected input field missies a properly associated label.
Additionally, the visible all caps text
PASSWORDis actually a stray label element that is not associated with any input. That's invalid HTML and also an a11y issue.Why?
The actual labeling of this field is currently given only by its placeholder text, which is the last fallback in the accessible name computation. That's not great. Also, for consistency with the very similar input field in the post editor, labeling and semantics should be consistent.
Regarding the visible all caps text
PASSWORD, that should not be a label element. It can be a fieldset legend so that the toggle and the input are grouped in a named group.How?
Adds a missing label for the password protected input field.
Removes a wrong usage of the
BaseControlcomponent that was rendering a stray label element Replaced with a fieldset and legend elements.Testing Instructions
PASSWORDis a stray label element:PASSWORDis now a legend element within a fieldset element.Testing Instructions for Keyboard
Screenshots or screencast