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

Don't apply flash* classes to banners #2289

Merged
merged 3 commits into from
Oct 27, 2022
Merged

Don't apply flash* classes to banners #2289

merged 3 commits into from
Oct 27, 2022

Conversation

camertron
Copy link
Contributor

What are you trying to accomplish?

We've run into some issues attempting to migrate usages of Primer::Beta::Flash to Primer::Beta::Banner, namely that existing CSS and JS in dotcom select on the flash class and its friends. This has made it really difficult to migrate to the Banner component because the flash class is no longer used.

What approach did you choose and why?

To ease the transition, we propose adding these legacy class names to banner elements while updating primer/css to only apply flash styles to elements that are not also banner elements.

Can these changes ship as is?

  • Yes, this PR does not depend on additional changes. 🚢

@camertron camertron requested a review from a team as a code owner October 27, 2022 21:32
@camertron camertron requested a review from tobiasahlin October 27, 2022 21:32
@changeset-bot
Copy link

changeset-bot bot commented Oct 27, 2022

🦋 Changeset detected

Latest commit: 6034d2e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/css Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@camertron camertron requested a review from jonrohan October 27, 2022 21:32
@camertron camertron temporarily deployed to github-pages October 27, 2022 21:39 Inactive
@github-actions github-actions bot temporarily deployed to Storybook Preview October 27, 2022 21:40 Inactive
@github-actions github-actions bot temporarily deployed to Storybook Preview October 27, 2022 21:40 Inactive
Copy link
Member

@jonrohan jonrohan left a comment

Choose a reason for hiding this comment

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

One downside to this approach is it'll increase the specificity of the flash styles, if there's any custom CSS in dotcom overriding one of the properties here it'll stop working. We chatted about this and decided that we could address those places specifically by increasing the importance or refactoring away.

I had a non-blocking question but overall think this should be safe to do.

@@ -86,7 +86,7 @@
}
}

.flash-warn {
.flash-warn:not(.Banner--warning) {
Copy link
Member

Choose a reason for hiding this comment

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

It maybe sufficient enough here to include :not(.Banner) on all of these instead of the scheme but could also be fine to include this as the Banner scheme also if you think there's a case where someone would have flash-* with Banner--* but not have Banner

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm interesting. I don't think that would happen? Let's go with :not(.Banner) for now.

@github-actions github-actions bot temporarily deployed to Storybook Preview October 27, 2022 22:08 Inactive
@camertron camertron merged commit c23346b into main Oct 27, 2022
@camertron camertron deleted the flash_not_banner branch October 27, 2022 22:58
@primer-css primer-css mentioned this pull request Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants