Skip to content
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

Closed
wants to merge 8 commits into from
Closed

Conversation

Stagge
Copy link
Contributor

@Stagge Stagge commented Mar 4, 2024

Fixes

Fixes #3190 by @dhruvkb

Description

The VTag component added in #3137 has been improved in the following ways:

  • All props are forwarded to the inner VButton
  • All events are emitted from the inner VButton
  • The content is displayed with a slot for the content instead of a prop.
  • Accessible labels to the links have been added to clearly indicate that the link is a tag.
  • Tests for the VTag component has been added.

Checklist

  • My pull request has a descriptive title (not a vague title likeUpdate index.md).
  • My pull request targets the default branch of the repository (main) or a parent feature branch.
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added or updated tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no visible errors.
  • I ran the DAG documentation generator (if applicable).

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

Stagge and others added 7 commits February 27, 2024 13:04
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>
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
@Stagge Stagge requested a review from a team as a code owner March 4, 2024 08:36
@Stagge Stagge requested review from zackkrida and obulat March 4, 2024 08:36
@openverse-bot openverse-bot added 🟩 priority: low Low priority and doesn't need to be rushed ✨ goal: improvement Improvement to an existing user-facing feature 💻 aspect: code Concerns the software code in the repository 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Mar 4, 2024
@zackkrida zackkrida added the 🧱 stack: frontend Related to the Nuxt frontend label Mar 5, 2024
@zackkrida zackkrida requested review from dhruvkb and removed request for zackkrida March 5, 2024 17:46
@obulat obulat removed the 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work label Mar 6, 2024
Copy link
Contributor

@obulat obulat left a 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"
Copy link
Contributor

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.

Copy link
Contributor

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"
Copy link
Contributor

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
aria-label="Tag"

v-bind ="$props"
v-on="$listeners"
aria-label="Tag"
><slot></slot></VButton
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
><slot></slot></VButton
><slot /></VButton

We usually use the self-closing tag if there's no content.

@Stagge
Copy link
Contributor Author

Stagge commented Mar 7, 2024

Thanks for the review! :)

I have implemented your suggestions in e41f162

@zackkrida zackkrida requested a review from obulat March 7, 2024 21:00
@openverse-bot

This comment was marked as outdated.

Copy link
Contributor

@obulat obulat left a 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"
Copy link
Contributor

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.

Suggested change
v-bind ="$props"
v-bind ="$attrs"

Copy link
Contributor

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)

@obulat obulat marked this pull request as draft March 12, 2024 15:27
@zackkrida
Copy link
Member

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!

@Stagge
Copy link
Contributor Author

Stagge commented Mar 25, 2024

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
v-bind ="$props"
v-bind ="$attrs"

@obulat obulat mentioned this pull request Mar 27, 2024
8 tasks
@obulat
Copy link
Contributor

obulat commented Mar 27, 2024

Hey! Sadly we won't have time to finish this, so feel free to let someone take over. Thanks!

Thank you for all of your work here, @Stagge ! I couldn't update this PR due to permission issues, so I created a new one with these changes in #3975

@obulat obulat closed this Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: frontend Related to the Nuxt frontend
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Refactor and improve VTag component
7 participants