Skip to content

feat: add opaque buttons and text-opaque utility#3620

Open
MaxLardenois wants to merge 7 commits into
mainfrom
ouds/main-opaque-background-for-hover-state-of-button-and-link
Open

feat: add opaque buttons and text-opaque utility#3620
MaxLardenois wants to merge 7 commits into
mainfrom
ouds/main-opaque-background-for-hover-state-of-button-and-link

Conversation

@MaxLardenois

@MaxLardenois MaxLardenois commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Types of change

  • Non-breaking change
  • Breaking change (fix or feature that would change existing functionality and usage)

Related issues

Closes #3569

Context & Motivation

Description

Checklists

  • I have read the contributing guidelines
  • My change follows the developer guide
  • My change pass all tests
  • My change is compatible with a responsive display
  • I have added tests (Javascript unit test or visual) to cover my changes
  • My change introduces changes to the documentation that I have updated accordingly
    • Title and DOM structure is correct
    • Links have been updated (title changes impact links)
    • CSS for the documentation
  • I have checked all states and combinations of the component with my change
  • I have checked all the impacts for the other components and core behavior (grid, reboot, utilities)

Checklist (for Core Team only)

  • The changes need to be in the migration guide
  • The changes are well displayed in Storybook (be careful if example order has changed for DSM)
  • The changes are compatible with RTL
  • Manually test browser compatibility with BrowserStack (Chrome 120, Firefox 121, Edge 120, Safari 15.6, iOS Safari, Chrome & Firefox on Android)

Progression (for Core Team only)

Live previews

@netlify

netlify Bot commented Jun 25, 2026

Copy link
Copy Markdown

Deploy Preview for boosted ready!

Name Link
🔨 Latest commit 126b447
🔍 Latest deploy log https://app.netlify.com/projects/boosted/deploys/6a465937a3b6ce00082b1ec5
😎 Deploy Preview https://deploy-preview-3620--boosted.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@MaxLardenois
MaxLardenois marked this pull request as ready for review July 2, 2026 11:59
@boosted-bot boosted-bot moved this from In Progress / Draft to Need Dev Review in 🟣 [Orange-Boosted-Bootstrap] PRs Board Jul 2, 2026
The `.opacify` class is only available for `.btn-strong` buttons.
</Callout>

<Example buttonLabel="buttons on colored backgrounds" class="p-none bd-btn-example bd-first-rounded" code={`<div class="bg-surface-brand-primary p-large d-flex gap-xsmall flex-wrap" style="background-image: url('https://fastly.picsum.photos/id/628/1000/300.jpg?hmac=scpBB5Z4eJBipw0O_j2T60oQcGjH8xoOA0OG42tW0go')">

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this url something internal that can be used in this context ? shouldn't we get this asset in our repo to avoid depending on external resources ?

@louismaximepiton louismaximepiton linked an issue Jul 6, 2026 that may be closed by this pull request
2 tasks

@louismaximepiton louismaximepiton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm still not convinced of the utility of it. IMO the identified use cases would be largely filled via the existing variants on colored bg in combination with a semi-transparent bg on an image when needed or even a zigzag rather than writing on an image. I feel it's wrong in the direction we want to give to people.

In the meantime, some comments:

@@ -0,0 +1,4 @@
.text-muted.opacify {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you know if there is a name on design side for this .opacify class ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There is no design spec for this


### Opaque links

On image background, you can use the `.opacify` class to make links more readable. This class adds an opaque background to the link for the `:hover`, `:focus-visible`, and `:active` states, improving contrast and visibility against complex backgrounds.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does it apply only on some variants of the links ?


## Opaque text muted

On image background, you can use the `.opacify` class to make `.text-muted` more readable. This class adds an opaque background to the text, improving contrast and visibility against complex backgrounds.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why on text-muted only ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's the only semi-transparent color

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We also have .text-disabled but ok I see your point

Comment thread scss/_buttons.scss
&:hover,
&:active,
&:focus-visible {
background-color: var(--bs-color-bg-primary);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
background-color: var(--bs-color-bg-primary);
background-color: var(--#{$prefix}color-bg-primary);

Comment thread scss/_buttons.scss
&:active,
&:focus-visible {
background-color: var(--bs-color-bg-primary);
background-image: linear-gradient(var(--#{$prefix}btn-hover-bg));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we keep the hover every time ? Where can the specs be found ?


On image background, you can use the `.opacify` class to make `.text-muted` more readable. This class adds an opaque background to the text, improving contrast and visibility against complex backgrounds.

<Example buttonLabel="links on colored backgrounds" class="p-none bd-btn-example bd-first-rounded" code={`<div class="bg-surface-brand-primary p-large d-flex gap-medium flex-wrap" style="background-image: url('https://fastly.picsum.photos/id/534/1000/300.jpg?hmac=uKVRRoCBPDGUvOZ5ZockbHITRiP-GoVWyQ2WtBpcrB8')">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

A good accessibility practice is to set a background-color close to the color on the image whenever an image is used. Do you think we should add this good practice in our doc ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Ok but do we have enough colors for that?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think so

@boosted-bot boosted-bot moved this from Need Dev Review to Dev Review In Progress in 🟣 [Orange-Boosted-Bootstrap] PRs Board Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Dev Review In Progress

Development

Successfully merging this pull request may close these issues.

opaque background for hover state of button and link

4 participants