-
Notifications
You must be signed in to change notification settings - Fork 214
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
Improve VTag component #3870
Improve VTag component #3870
Conversation
Closes #3. Co-authored-by: FelixSjogren <felixarvidsjogren@gmail.com>
FEAT - Make VTag pass all props to inner VButton. (#3)
Closes #2 Co-authored-by: Stagge <jonatan.stagge@gmail.com>
Feat/2 slot for the content (#2)
Added tests for Vtag, tests include: All props are sent to VButton VTag renders slot content Renders anchor tag. Co-authored-by: Stagge <jonatan.stagge@gmail.com>
- Added aria-label to indicate that that the link is a tag
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 is a great, and implements everything that's required in the issue, @DD2480-Group-23!
However, I am not sure about the accessibility. Right now, if this is implemented as is, a screen reader loses all information about the tag (previously, they would hear something like "Link cat" for each tag, now they hear "Link Tag" for every tag). I will add accessibility recommendations as soon as I get the reply from the #accessibility channel.
>{{ title }}</VButton | ||
v-bind ="$props" | ||
v-on="$listeners" | ||
aria-label="Tag" |
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.
Adding the aria-label like this will cause the screen reader to say something like "Link tag, link tag, link tag" - which is confusing because the user does not understand what the tag name is. This should probably be a computed text, something like " tag", but I'm not sure.
I asked in the Make WordPress Slack #accessibility channel (requires registration for access), and will add a comment here when I get a reply.
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 received a reply from the accessibility team.
Using aria-label
to provide more context is not recommended. It helps blind screen reader users, but makes things less accessible for other users.
For example:
Sighted users who use screen readers as an aid: they will see visible text that is different from what the screen reader announces.
Speech recognition software users: they will see some visible text and try to use that to issue a voice command but the assistive technology takes into consideration the accessible name provided by the aria-label, which would be different.
Generally, it’s best to not alter the accessible name.
So, for this PR, we need to remove aria-label
completely.
>{{ title }}</VButton | ||
v-bind ="$props" | ||
v-on="$listeners" | ||
aria-label="Tag" |
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 received a reply from the accessibility team.
Using aria-label
to provide more context is not recommended. It helps blind screen reader users, but makes things less accessible for other users.
For example:
Sighted users who use screen readers as an aid: they will see visible text that is different from what the screen reader announces.
Speech recognition software users: they will see some visible text and try to use that to issue a voice command but the assistive technology takes into consideration the accessible name provided by the aria-label, which would be different.
Generally, it’s best to not alter the accessible name.
So, for this PR, we need to remove aria-label
completely.
>{{ title }}</VButton | ||
v-bind ="$props" | ||
v-on="$listeners" | ||
aria-label="Tag" |
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.
aria-label="Tag" |
v-bind ="$props" | ||
v-on="$listeners" | ||
aria-label="Tag" | ||
><slot></slot></VButton |
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.
><slot></slot></VButton | |
><slot /></VButton |
We usually use the self-closing tag if there's no content.
Thanks for the review! :) I have implemented your suggestions in e41f162 |
This comment was marked as outdated.
This comment was marked as outdated.
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.
The CI is currently failing. To fix the lint step, you need to run just lint
in the repository and commit the changes.
@@ -4,8 +4,9 @@ | |||
size="small" | |||
variant="filled-gray" | |||
class="label-bold" | |||
:href="href" | |||
>{{ title }}</VButton | |||
v-bind ="$props" |
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.
props
are automatically passed to the child component in Vue, but some attrs
are not. We need to bind attrs
here.
v-bind ="$props" | |
v-bind ="$attrs" |
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 am going to draft this PR until the changes are addressed (linting and binding $attrs instead of $props)
Hi @Stagge are you interested in resuming work on this PR? If you aren't able to we can have a maintainer work on it for you to get it across the finish line. Thank you! |
Hey! Sadly we won't have time to finish this, so feel free to let someone take over. Thanks! |
@@ -4,8 +4,9 @@ | |||
size="small" | |||
variant="filled-gray" | |||
class="label-bold" | |||
:href="href" | |||
>{{ title }}</VButton | |||
v-bind ="$props" |
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.
v-bind ="$props" | |
v-bind ="$attrs" |
Fixes
Fixes #3190 by @dhruvkb
Description
The VTag component added in #3137 has been improved in the following ways:
Checklist
Update index.md
).main
) or a parent feature branch.Developer Certificate of Origin
Developer Certificate of Origin