-
Notifications
You must be signed in to change notification settings - Fork 50
Improve display of labels (fixes #602) #626
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
Conversation
|
@hamilton you have some expertise in this area, could you comment on the a11y side of things? |
hamilton
left a comment
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.
@wlach asked me to take a look. From an accessibility standpoint, it looks like label-5 has contrast issues with white text. It may be somewhat easier to not allow people to mix and match text + label with this in mind. I don't see any contrast issues with the other ones.
I left some take-or-leave suggestions as well.
wlach
left a comment
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 looks great, I defer to @hamilton's suggestions on the tweaks.
I think we may want to define more "types" of labels in the future (ala what you did with expired and deprecated), but I think this implementation is more than good enough to start with.
|
@linh my pleasure! It's actually built-in to Firefox devtools – look for "Accessibility" in the tabs. |


Storybook for Label.svelte:

Some notes:
I wanted to find a color palette that is color-blind friendly. This article recommends a few different palettes, and I decided to go with the light colors as I find them fit the best with Protocol. The pill design is largely inspired by Github labels.
To make this component more reusable, such that the same text will get the same color, I generate the label color using an A1Z26 cipher. The text is first turned into a number from 1-9, then from this number we can get a color from the color palette map.
However, if for some reason we want to use a specific color for the pill, we can override the above method by setting a
labelNumbernumber. I did this with thedeprecatedandexpiredlabels.I'm not sure if this approach is more complicated than necessary, and I'm open to feedback if there's any way we can improve it :)
Pull Request checklist
fixes, if applicable)