-
Notifications
You must be signed in to change notification settings - Fork 327
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
Additional Tag modifier classes for different colours #1711
Conversation
src/govuk/components/tag/_tag.scss
Outdated
@@ -20,6 +20,8 @@ | |||
text-decoration: none; | |||
text-transform: uppercase; | |||
|
|||
white-space: nowrap; |
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 change seems unrelated to the commit description – if it's required, can we make this change in another commit that explains why it's being added, or possibly make it part of a separate PR?
@@ -41,4 +43,50 @@ | |||
.govuk-tag--inactive { | |||
background-color: govuk-colour("dark-grey", $legacy: "grey-1"); | |||
} | |||
|
|||
.govuk-tag--grey { |
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.
We should consider whether there's a need for inactive
and grey
, or whether they can be the same thing.
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.
Yeah. I considered deleting it, but I thought that would delay the contribution as I assumed it would be a breaking change.
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.
We could consider marking it as deprecated, for example.
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.
Yeah, and actually, it's not documented on the Tag component page. Is it documented publically elsewhere?
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've left it in, and maybe the deprecation can be a release note? Or do I need to do something in the code to mark it as deprecated?
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.
Since it's not been documented we could consider dropping it in 4.0.0
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.
@adamsilver Would you be okay to add something like
Deprecated. We will be removing this class in a future release, use `.govuk-tag--grey` instead.
above the govuk-tag--inactive
class in the scss file? 🙏
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.
@hannalaakso done.
I think it's worth carefully considering the modifier names, if we name them based on their colour and decide the colours in the future need to change they may not make sense anymore or require a breaking change? Good ol' bootstrap has this sort of thing with their 'badges' and they use broad semantic names which might be worth considering: |
Yeah—I did consider this as I said in the PR description. I think it would be too difficult to come up with useful names (I checked Bootstrap) and I also think it could mean code within a service could be confusing... For example, let's say we call the orange variant ‘warning-2’ and the yellow ‘warning-1’. (The reason for the numbers is because there aren't enough generic class names.) Let's imagine I use ‘warning-1’ because in Apply for teaching training we want the ‘withdrawn’ status to be yellow. That would indicate “withdrawn’ is some sort of warning when it isn't. Also, while colours have changed and may change again, I think it's less likely that colours will change to the point that an entire colour disappears. So perhaps the tint would change (like it did last time) but that sort of change was signficant to my knowledge and would affect multiple styles, components and patterns. @NickColley that said, I think it's the design system team's call and if you think names are better, than would you be able to suggest the names for all of the colours? |
@adamsilver I think you might be right that it's too difficult to have semantics that can anticipate what context these are used in and the colours dont change often. |
Good discussion! I'm comfortable with the colour-based class names, as they're aligned with the names in our colour palette. I totally agree that we can't anticipate all future semantic states that the tags will be used to represent. But we might converge on a few one day (eg. 'success', 'warning', 'fail' etc.) - does this approach block us from doing that in the future? |
I think that would be fine because we could just add an additional |
I don't know if this has been brought up elsewhere but, to me at least, the red and orange look very similar. To the point where I might not notice they were different. To a slightly lesser extent, the red and pink do too. |
@peteryates some of us at DfE thought the same thing, but we weren't overly concerned because:
|
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 is looking great 🎉 I think the following two bits just needs to be resolved and then we can merge this.
@adamsilver Thanks for updating the PR. We're now thinking that 1d79100 should be moved to its own PR as it could possibly be a breaking change as it could change your layout (esp on mobile) by forcing a longer tag to stay on its own line. We should talk about it separately. Apologies for the back and forth on this 🙁 If you were able to remove the commit from this PR (or I can do it if you prefer) we can get this one merged. Thank you! |
@hannalaakso thank you—I'd be delighted to take you up on your offer to do it for me pls :) |
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.
Great work, thank you @adamsilver 👏
On 13 February 2020 the Design System working group approved the addition of different coloured variants of this component. (Just mentioning this for reference as I didn't see it explicitly mentioned in the comments on this PR.) |
Class govuk-tag--inactive was replaced by govuk-tag--grey and deprecated in PR #1711. This commit replaces references to it in our tests, examples, and fixtures.
Class govuk-tag--inactive was replaced by govuk-tag--grey and deprecated in PR #1711. This commit removes the class completely. You should replace any uses of this class with `.govuk-tag--grey`.
Class govuk-tag--inactive was replaced by govuk-tag--grey and deprecated in PR #1711. This commit removes the class completely. Users should replace any uses of this class with `.govuk-tag--grey`.
Class govuk-tag--inactive was replaced by govuk-tag--grey and deprecated in PR #1711. This commit removes the class completely. Users should replace any uses of this class with `.govuk-tag--grey`. Co-authored-by: Oliver Byford <[email protected]>
Class `govuk-tag--inactive` was replaced by `govuk-tag--grey` and deprecated in PR #1711. This commit replaces references to it in our tests, examples, and fixtures.
Class govuk-tag--inactive was replaced by govuk-tag--grey and deprecated in PR #1711. This commit removes the class completely. Users should replace any uses of this class with `.govuk-tag--grey`. Co-authored-by: Oliver Byford <[email protected]>
I spoke with @36degrees and then @timpaul about contributing additional Tag component styles via modifier classes. A lot of services (citizen-facing and internal) use the Tag component for different statuses.
Most of the time, different colours are used as an enhancement to spot those different states easily. Most of the designs I've seen put white text on coloured backgrounds. At DfE we did the same but they fail contrast requirements.
So we now uses these styles which are accessible and use the tints and shades of the GOV.UK colour palette.
More information here:
alphagov/govuk-design-system-backlog#62 (comment)
Note:
I would usually look for meaningful names for modifier classes like ‘urgent’ but statuses are often unique to the system and so I used colours for the class names giving users flexibility.
I still need to add guidance / examples to the design system repo. I'm not sure what the process is on that i.e. do I wait for this to be merged or something more elaborate?
Screenshot: