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

Using the new ariaLabelledBy prop in KSwitch #12918

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

RONAK-AI647
Copy link

@RONAK-AI647 RONAK-AI647 commented Dec 7, 2024

Summary

1)There are many uses of Kswitch in kolibri's codebase. learningequality/kolibri-design-system#806
introduced a new feature named arialLabelledBy in KDS , using that feature , some of the Kswitchs' doesnt have a label set.

  1. We should use the new ariaLabelledBy prop in KSwitch to point to the element that has the label corresponding to the switch component.

3)All KSwitch components should have a label, either set by the ariaLabelledBy or by the label prop

References

#12743

Issue/learningequality/kolibri-design-system#806

Reviewer guidance

@github-actions github-actions bot added APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend labels Dec 7, 2024
@MisRob MisRob added the TODO: needs review Waiting for review label Dec 9, 2024
@MisRob
Copy link
Member

MisRob commented Dec 9, 2024

Thanks for yet another contribution @RONAK-AI647 :)! I will invite my colleagues @LianaHarris360 or @marcellamaki for review.

One thing I noticed myself concerns translations of strings. Please have a look at how to write localized strings and try to follow the guide.

@marcellamaki
Copy link
Member

marcellamaki commented Dec 10, 2024

Hi @RONAK-AI647 - thanks for your contribution! The main goal of using aria-labeledby is to associate text that is present on the page to another element. It's usually applied in specific scenarios where something is visually apparent, but semantically within the HTML, would not be properly associated with someone who is using a screen reader.

What text in the UI are you trying to associate with each of these elements? How might you do that without adding additional spans and text?

Screenshot 2024-12-10 at 4 50 27 PM

<KSwitch
name="toggle-quiz-visibility"
:aria-labelledby="'toggle-quiz-visibility'"
Copy link
Member

Choose a reason for hiding this comment

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

Should this line match the id='toggle-quiz-visibility-label' in the span above?

Copy link
Member

Choose a reason for hiding this comment

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

Also, shouldn't the prop be named ariaLabelledBy rather than :aria-labelledby?

Copy link
Member

@LianaHarris360 LianaHarris360 left a comment

Choose a reason for hiding this comment

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

Some great thoughts have already been shared, I just had a couple more points to add. Thanks for your work on this @RONAK-AI647 !

v-else
:key="`switch-${lesson.id}`"
v-else:
key="`switch-${lesson.id}`"
Copy link
Member

Choose a reason for hiding this comment

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

I believe this piece of code is causing an error in my code editor. Is there a particular reason that the : colon was moved from in front of key and positioned after v-else?

name="toggle-lesson-visibility"
:ariaLabelledBy="`toggle-lesson-visibility-label-${lesson.id}`"
label=""
Copy link
Member

Choose a reason for hiding this comment

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

Since it is set as an empty string, is the label property still required now that we have the ariaLabelledBy prop in use?

<KSwitch
name="toggle-quiz-visibility"
:aria-labelledby="'toggle-quiz-visibility'"
Copy link
Member

Choose a reason for hiding this comment

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

Also, shouldn't the prop be named ariaLabelledBy rather than :aria-labelledby?

@RONAK-AI647
Copy link
Author

Thank You everybody for reviewing @marcellamaki @LianaHarris360 @nucleogenesis @MisRob , give me some time , i will return with everything resolved .!!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants