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

feat: Adding necessary labels to increase accessibility of screens #2755

Closed
wants to merge 0 commits into from

Conversation

Rithvik-padma
Copy link
Contributor

@Rithvik-padma Rithvik-padma commented Sep 16, 2023

Describe the changes you have made in this PR

Added labels at various places in the following screens -

  1. Default screen
  2. Receive screen
  3. Send screen
  4. Result screen

Link this PR to an issue [optional]

Fixes #2573

Type of change

feat: New feature (non-breaking change which adds functionality)

Screenshots of the changes [optional]

Add screenshots to make your changes easier to understand. You can also add a video here.

How has this been tested?

Tested the labels using a screen reader but few screens have not been tested as I am using a testnet (send and result screens).

Checklist

  • Self-review of changed code
  • Manual testing
  • Added automated tests where applicable
  • Darkmode
  • Responsive layout

@Rithvik-padma Rithvik-padma marked this pull request as draft September 16, 2023 18:24
@Rithvik-padma Rithvik-padma marked this pull request as ready for review September 17, 2023 14:45
@Rithvik-padma
Copy link
Contributor Author

@stackingsaunter @rolznz Can you review this PR.
Thanks!

@@ -16,6 +16,10 @@ function BalanceBox({ className }: Props) {
"w-full flex flex-col items-center justify-center dark:text-white p-4",
className ?? ""
)}
tabIndex={0}
aria-label={`Balance: ${balancesDecorated.accountBalance}${
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we use aria-label here and not where the balance is rendered?

could a simple label like "balance" be added to the div that actually renders the value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can add the aria-label to the BalanceBox component directly at the place where it is rendering I have added it in the div inside the component so that at every place the BalanceBox component is being used the screen reader can detect it but ig in this case BalanceBox is used only at one place so I will add it there itself.

I did not get your second point here, can you elaborate a bit?

Copy link
Contributor

Choose a reason for hiding this comment

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

basically we just need to describe what the value means, right? We don't have to add a label which duplicates the actual content that we already render?

As far as I understand, this is for cases where there is just a number with no context for visually-impaired people.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, but in this case by using the aria-label attribute we are erasing the default label (which is the child elements' text) and creating a new label which replaces the default label rather than adding/extending to it. So that is hy there is a need of adding the data again to the aria-label.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Rithvik-padma I do not believe that is true. aria-label does not replace anything, it just enhances and provides more information.

A simple example would be:
<div aria-label="Wallet Balance">{walletBalance}</div>

A visually impaired user does not know the number inside the div is the balance. But the aria-label enhances that div and reads both the value, and the label.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rolznz
No, I felt it does the same initially but I have tested this format using a screen reader but this doesn't work, the screen reader only reads only the aria-label value but not the value inside it.
These are the resources I have referred to confirm - Stackoverflow, Medium post and also MDN docs.

Anyway there is an alternative which is using a label at the necessary places and making it visually hidden using the sr-only class provided by tailwindcss. I have tested this method using screen reader, it works fine and looks like a better solution for labels.
Should I use this method instead of using aria-label attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rolznz No, I felt it does the same initially but I have tested this format using a screen reader but this doesn't work, the screen reader only reads only the aria-label value but not the value inside it. These are the resources I have referred to confirm - Stackoverflow, Medium post and also MDN docs.

Anyway there is an alternative which is using a label at the necessary places and making it visually hidden using the sr-only class provided by tailwindcss. I have tested this method using screen reader, it works fine and looks like a better solution for labels. Should I use this method instead of using aria-label attribute?

@rolznz any thoughts on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Rithvik-padma I like the suggestion in the stack overflow answer you linked:

<p><span class="visually-hidden">Participant</span> Martin Clark</p>

There is support in tailwind for this: https://tailwindcss.com/docs/screen-readers

That way we can remove some of the duplication. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I will make changes for it

@Rithvik-padma
Copy link
Contributor Author

@rolznz I have made the changes as per your review.
@stackingsaunter Can u test the changes.
Thanks!

@rolznz
Copy link
Contributor

rolznz commented Sep 19, 2023

@rolznz I have made the changes as per your review. @stackingsaunter Can u test the changes. Thanks!

Before the changes can be tested we need to make sure we do this right. I think there needs some more changes first.

@Rithvik-padma
Copy link
Contributor Author

@rolznz I have made the changes as per your review. @stackingsaunter Can u test the changes. Thanks!

Before the changes can be tested we need to make sure we do this right. I think there needs some more changes first.

Sure got it!

@Rithvik-padma
Copy link
Contributor Author

@rolznz @stackingsaunter any update on this?

@Rithvik-padma
Copy link
Contributor Author

@stackingsaunter any views on this PR?

@reneaaron
Copy link
Contributor

There seem to be quite some merge conflicts and also all of the accessibility strings seem to miss translations 🤔 Can you update this PR and add them (try to use existing translations wherever possible)

@stackingsaunter
Copy link
Contributor

@Rithvik-padma sorry to keep you waiting that long for the review! I can't test it right now, but will gladly do with fixes that @rolznz and @reneaaron mentioned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add missing labels to increase accessibility
4 participants