Skip to content

[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

Merged
merged 1 commit into from
Oct 8, 2017
Merged

Conversation

Nyholm
Copy link
Member

@Nyholm Nyholm commented Oct 5, 2017

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.

@Nyholm Nyholm changed the title Use for=ID on radio/checkbox label. [Form] Use for=ID on radio/checkbox label. Oct 5, 2017
@@ -147,10 +147,14 @@
{% endblock choice_label %}

{% block checkbox_label -%}
{%- set label_attr = label_attr|merge({for: id}) -%}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing quotes {'for': id}

Copy link
Member

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.)

Copy link
Member Author

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.

Copy link
Contributor

@sstok sstok left a 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 🤔

@Nyholm
Copy link
Member Author

Nyholm commented Oct 5, 2017

Thank you for the review. Yeah you might be correct. This could be considered a bugfix.

@xabbuh
Copy link
Member

xabbuh commented Oct 5, 2017

To me that's a bugfix.

@fabpot
Copy link
Member

fabpot commented Oct 5, 2017

@Nyholm Can you change the base branch to 2.7 (I think that should be considered as a bug fix).

@Nyholm Nyholm changed the base branch from master to 2.7 October 5, 2017 14:56
@Nyholm Nyholm changed the base branch from 2.7 to master October 5, 2017 14:56
@Nyholm
Copy link
Member Author

Nyholm commented Oct 5, 2017

Tried to do it on the phone and failed. Will fix this when I get to a computer.

Thank you for the reviews.

@Nyholm Nyholm changed the base branch from master to 2.7 October 6, 2017 01:30
This is required for some screen reader like Jaws
@Nyholm
Copy link
Member Author

Nyholm commented Oct 6, 2017

Added the fix for branch 2.7

@xabbuh
Copy link
Member

xabbuh commented Oct 6, 2017

I wonder if we don't have to update any test fixtures.

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Oct 8, 2017
@fabpot
Copy link
Member

fabpot commented Oct 8, 2017

Thank you @Nyholm.

@fabpot fabpot merged commit 53d7857 into symfony:2.7 Oct 8, 2017
fabpot added a commit that referenced this pull request Oct 8, 2017
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.
@Nyholm Nyholm deleted the form-wcag-id branch October 13, 2017 03:00
This was referenced Nov 10, 2017
@fabpot fabpot mentioned this pull request Nov 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants