Work out what to do with styled links in the notification banner component
See original GitHub issueWhat
Links in the error summary are red, because we target them in the component CSS:
We’ve flagged in #1732 that this seems to break the BEM principles applied elsewhere, where we style things explicitly as elements using classes, rather than using tags in the selector.
From talking to @christopherthomasdesign, when we build the notification banner, we want to make the links red for the error variant and green for the success variant, so we’ll have a similar issue.
We should consider:
- that this is a valid use case to bend the BEM principles and using the same approach we use in the error summary
- creating error and success a link element and modifiers, scoped within the component (for example
govuk-notification-banner__link govuk-notification-banner__link--error
) - creating error and success link modifiers (for example
govuk-link govuk-link--error
)
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
How to Create a Website Notification Bar + 10 Great Examples
We are all familiar with website notification bars. So, today let's actually learn how they work and what some good examples are.
Read more >Alert Banner Best Practices (Web Design for Disaster, Part 1)
Links should be underlined or made into buttons so they can be easily identified.
Read more >8 Tips for Designing Inclusive Notifications and Alerts
If the banner contains a link, make it look obvious with an underline. If it contains buttons make sure it looks like it...
Read more >Notifications - Carbon Design System
Notifications are an important method of communicating with users and providing feedback.
Read more >How to optimize your website alert banners and keep users in ...
Follow these tips and best practices for placement, content, style, and functionality to create the best alert banner for your website.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Changed approach on this while implementing as we noticed a difference in the way we were styling the notification header and text (based on a parent modifier class) vs links (having its own modifier class). We think it makes more sense for things to be consistent, and as this BEM guidance states it is allowed to style a sub-element based on a parent-element modifier. So we’ve essentially switched from option 2b to 2a
@vanitabarrett Yes I think what the others have said makes a lot of sense about the dangers of different styles of conflicting. I think 2b is probably the best option. 2a sounds okay as well but it could be a little bit too “magic” to make it clear how the styles get applied.