-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Use for=ID on radio/checkbox label. #24434
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
Conversation
@@ -147,10 +147,14 @@ | |||
{% endblock choice_label %} | |||
|
|||
{% block checkbox_label -%} | |||
{%- set label_attr = label_attr|merge({for: id}) -%} |
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.
Missing quotes {'for': id}
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.
really? I never quote the keys in Twig (unless strictly required because of white spaces, etc.)
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.
Quoting is no requirement in Twig. I thought Sebastian suggested it because it is a part of the code standard.
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.
Good idea, but Twig key name needs to be quoted.
Also this is can be considered a bug fix 🤔
Thank you for the review. Yeah you might be correct. This could be considered a bugfix. |
To me that's a bugfix. |
@Nyholm Can you change the base branch to 2.7 (I think that should be considered as a bug fix). |
Tried to do it on the phone and failed. Will fix this when I get to a computer. Thank you for the reviews. |
This is required for some screen reader like Jaws
Added the fix for branch 2.7 |
I wonder if we don't have to update any test fixtures. |
Thank you @Nyholm. |
This PR was merged into the 2.7 branch. Discussion ---------- [Form] Use for=ID on radio/checkbox label. | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | I recently let Europe's leading accessibility experts (Funkanu.se) review a site of mine, they gave me (among other) this feedback. > Putting the checkbox/radio input inside the label is great, but the label still needs the "for=ID". Screen readers like Jaws does not work properly without this attribute. Commits ------- 53d7857 Use for=ID on radio/checkbox label.
I recently let Europe's leading accessibility experts (Funkanu.se) review a site of mine, they gave me (among other) this feedback.