-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
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
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ntsekouras thanks for your feedback, I added the div and class for consistency with the password field in the post editor, see
<div className="editor-post-visibility__password"> |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class name can be removed as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: consistency with the form used in the post editor, see
<fieldset className="editor-post-visibility__fieldset"> |
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
PASSWORD
is 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
BaseControl
component that was rendering a stray label element Replaced with a fieldset and legend elements.Testing Instructions
PASSWORD
is a stray label element:PASSWORD
is now a legend element within a fieldset element.Testing Instructions for Keyboard
Screenshots or screencast