-
Notifications
You must be signed in to change notification settings - Fork 152
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
Tag accessibility #4630
base: master
Are you sure you want to change the base?
Tag accessibility #4630
Conversation
Storybook staging is available at https://kiwicom-orbit-sarka-tab-a11y-fixes.surge.sh Playroom staging is available at https://kiwicom-orbit-sarka-tab-a11y-fixes.surge.sh/playroom |
Size Change: +65 B (+0.01%) Total Size: 463 kB
ℹ️ View Unchanged
|
d131a70
to
a772c2b
Compare
Deploying orbit with
|
Latest commit: |
60dec3d
|
Status: | ✅ Deploy successful! |
Preview URL: | https://684974a5.orbit.pages.dev |
Branch Preview URL: | https://sarka-tab-a11y-fixes.orbit.pages.dev |
c81df40
to
b85184b
Compare
{onRemove && ( | ||
<div | ||
className={cx( | ||
"orbit-tag-close-container", | ||
"ms-200 flex rounded-full", | ||
"pe-200 ps-100 rounded-r-150 flex items-center justify-center", |
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.
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.
It is very weird that the user is able to click outside of the icon and trigger the onRemove. Can you please check how other design systems approach this? 😕
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.
My first idea was to have "clickable" only the X
icon, but then I was thinking about it, and it could be difficult to click that area on mobile phones. also, it can easily happen that the user will click onClick
function instead of onRemove
, because there won't be enough space.
I've found some articles about "minimum" target size:
- https://dequeuniversity.com/rules/axe/4.9/target-size
- https://tetralogical.com/blog/2022/12/20/foundations-target-size/
Here is an example where the "dismiss" button is 100% height of the tag. The design is quite different, but it correspond the minimum 24px size according the accessibility rules.
https://carbondesignsystem.com/components/tag/code/ (variant selector - with AI label)
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.
Alright, I am sold. But I would loudly present this to designers so they can think of an eventual better solution
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'll write a note to the accessibility compliance doc.
Also, I can see that onRemove
and onClick
props are used in search - check sourcebot, however, they put the same function in both props. so the functionality is the same for both props, they just wanted to have a cross button in the Tag component (from what I understand). But it's something that should be managed from the UX side, I guess.
https://www.kiwi.com/cz/search/results/brno-cesko/oslo-norsko/anytime/no-return?stopNumber=0%7Etrue
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.
they put the same function in both props. so the functionality is the same for both props, they just wanted to have a cross button in the Tag component
Yes, but that is not an assumption we can't make for all the cases
726199d
to
b203237
Compare
...g.ct.tsx-snapshots/visual-Tag-screenshot-Colored-DateTag-Selected-focus-1-Desktop-darwin.png
Outdated
Show resolved
Hide resolved
{onRemove && ( | ||
<div | ||
className={cx( | ||
"orbit-tag-close-container", | ||
"ms-200 flex rounded-full", | ||
"pe-200 ps-100 rounded-r-150 flex items-center justify-center", |
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.
It is very weird that the user is able to click outside of the icon and trigger the onRemove. Can you please check how other design systems approach this? 😕
LLM Analysis of PR ChangesPull Request Feedback: /pull/4630 - Tag accessibilityHere's an analysis of the provided Git diff for pull request #4630: 1. Summary of Changes: This pull request focuses on improving the accessibility of the The changes can be summarized as follows:
2. Potential Issues or Bugs:
3. Suggestions for Improvements:
4. Security Concerns:
5. Code Quality Observations:
Overall Feedback: This is a positive pull request that enhances the accessibility of the Recommendations:
By addressing these points, this pull request will significantly improve the accessibility of the Orbit |
This commit includes the fix of a11y violation and makes the interactive controls elements as a siblings in the DOM hierarchy. Also, new label labelClose was added to allow aria-label for Close button.
1a5a46b
to
60dec3d
Compare
LLM Analysis of PR ChangesOkay, let's analyze the provided Git diff for the Orbit Tag component pull request. Pull Request Analysis for /pull/4630: Tag accessibility1. Summary of ChangesThis pull request focuses on improving the accessibility of the Orbit Key changes include:
2. Potential Issues or Bugs
3. Suggestions for Improvements
4. Security ConcernsThere are no immediate security concerns evident in this diff. The changes primarily focus on accessibility and visual presentation, and do not seem to introduce any new attack vectors or vulnerabilities. However, as always, ensure that any user-provided strings (like 5. Code Quality Observations
Overall Feedback: This pull request is a positive step towards improving the accessibility of the Orbit
After addressing these points, the pull request should be in good shape for merging. The changes are well-intentioned and improve the component's accessibility without introducing significant issues. |
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 noticed an issue with how we are structuring the component in different elements and I think it can be improved. Take a look at it, please
{...((onClick || onRemove) && { | ||
role: "button", | ||
tabIndex: 0, | ||
onClick, | ||
onKeyDown: ev => buttonClickEmulation(ev, onClick), | ||
})} |
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 silences the linter because it can't analyze this part of the code 😄
But actually… looking at this, I noticed a problem with our current implementation.
We are saying that any tag with onRemove
is rendered as a button. But we clearly have the dismiss icon separated from the "content", in two separate elements…
So why is a Tag with onRemove
but without onClick
focusable, clickable, and all, if only the dismiss part is clickable?
You can see this on the default story, the Tag that says "removable". I don't think it is working correctly.
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.
aha! good point.
Closes https://kiwicom.atlassian.net/browse/FEPLT-2269