-
Notifications
You must be signed in to change notification settings - Fork 86
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
Fix/no label input dropdown #1619
Conversation
✅ Deploy Preview for marvelous-moxie-a6e2fe ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
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.
Removing the label is definitely a bad idea as you suggest, for accessibility reasons. But I think we can provide allowing to hide the label, as requested, if we follow the recommendations here https://www.w3.org/WAI/tutorials/forms/labels/#hiding-label-text
So we try and make sure there is always a label, either visible or not.
I can think of two options, but probably there are many more:
- We make the
label
required, and add ahideLabelVisually
prop to make it visually hidden, and adjust the layout for the input text to be vertically aligned as in this PR ("approach 1" in the article) - We add an
innerAriaLabel
prop, and adjust the layout when no label is present ("approach 2" in the article)
@felix-ico what do you think?
@acstll I'd go for approach # 1, I'll make the necessary changes! 🙌 |
Co-authored-by: felix-ico <[email protected]>
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.
Looks good! — I think we should also add the new hideLabelVisually
prop to Storybook. Thank you!
@@ -241,16 +242,15 @@ export class TextField { | |||
'datetime-local', | |||
]; | |||
|
|||
console.log('HIDE LABEL ? ', this.hideLabelVisually, this.label); |
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.
🫣
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.
?? I'm not sure what happened here but this was removed a while ago 129a2b6
this would fix #827 ...not sure if it's a good idea to allow inputs without labels though