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

Fix *-dark rule #1293

Merged
merged 5 commits into from
Oct 12, 2022
Merged

Fix *-dark rule #1293

merged 5 commits into from
Oct 12, 2022

Conversation

louismaximepiton
Copy link
Member

@louismaximepiton louismaximepiton commented Jun 1, 2022

Fixes #1174

Search

I've searched for every -dark class in Boosted and even for "dark" word. It appears that every time it is called, this is for a background-color or at least a component that benefits from the rule. The only class that diverged was .border-dark that changes the border-color. So I decided to keep the rule and precised that .border-dark shouldn't interfere with it anymore.

My concerns are for Boosted users since this is a general rule that could break existing sites. If you agree, we should at least warn somewhere about this rule and add it to the migration guide. If you think that this rule should be more specific, please let me know.

Miscellaneous (out of PR)

I also discovered that Bootstrap has a bg-black that could maybe be removed (which will simplify our utility) since it's not mentioned anywhere nor used. I couldn't spot any breaking change using this, but I added a selector to that rule to handle this specific case.
Edit: Looks like this bg-black is wanted so let's keep it : twbs/bootstrap#34100

The second one is that we have plenty of classes .a11y-swatch-* that aren't used yet in site/assets/scss/colors.scss. Was wondering if we could use them to have maybe a better accessibility or visibility about this topic. Otherwise, they could be removed easily IMO.
Edit: Issue created #1297.

@netlify
Copy link

netlify bot commented Jun 1, 2022

Deploy Preview for boosted ready!

Name Link
🔨 Latest commit f422c86
🔍 Latest deploy log https://app.netlify.com/sites/boosted/deploys/6346768ccda4aa00087c67b0
😎 Deploy Preview https://deploy-preview-1293--boosted.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@julien-deramond
Copy link
Member

Note: we need to check if it works with the new .text-bg-dark

scss/_root.scss Outdated Show resolved Hide resolved
Copy link
Member

@julien-deramond julien-deramond left a comment

Choose a reason for hiding this comment

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

This change looks good to me.

As said in the description, I also think we should mention somewhere in the documentation that those rules exist in order to be able to handle dark variants. Not a big fan of the place, but I'd said the most appropriate place is /docs/5.2/customize/color/. I let you propose something so that we can iterate on.

FYI, code used to test different use cases (doesn't include cascade of divs with different bg colors):

<div class="container-fluid p-4">
  <div class="row">
    <div class="col-12">
      1. Text
      <br>
      2. <a href="/">Link</a>
      <br>
      3. <code>test</code>
      <br>
      4. <kbd>Ctrl</kbd>
      <br>
      5. <mark>highlight</mark>
      <br>
      6. <pre>pre content</pre>
    </div>
  </div>
</div>

<div class="container-fluid p-4 border-dark border">
  <div class="row">
    <div class="col-12">
      1. Text
      <br>
      2. <a href="/">Link</a>
      <br>
      3. <code>test</code>
      <br>
      4. <kbd>Ctrl</kbd>
      <br>
      5. <mark>highlight</mark>
      <br>
      6. <pre>pre content</pre>
    </div>
  </div>
</div>

<div class="container-fluid p-4 text-dark">
  <div class="row">
    <div class="col-12">
      1. Text
      <br>
      2. <a href="/">Link</a>
      <br>
      3. <code>test</code>
      <br>
      4. <kbd>Ctrl</kbd>
      <br>
      5. <mark>highlight</mark>
      <br>
      6. <pre>pre content</pre>
    </div>
  </div>
</div>

<div class="container-fluid p-4 bg-black">
  <div class="row">
    <div class="col-12">
      1. Text
      <br>
      2. <a href="/">Link</a>
      <br>
      3. <code>test</code>
      <br>
      4. <kbd>Ctrl</kbd>
      <br>
      5. <mark>highlight</mark>
      <br>
      6. <pre>pre content</pre>
    </div>
  </div>
</div>

<div class="container-fluid p-4 bg-dark">
  <div class="row">
    <div class="col-12">
      1. Text
      <br>
      2. <a href="/">Link</a>
      <br>
      3. <code>test</code>
      <br>
      4. <kbd>Ctrl</kbd>
      <br>
      5. <mark>highlight</mark>
      <br>
      6. <pre>pre content</pre>
    </div>
  </div>
</div>

<div class="container-fluid p-4 bg-secondary">
  <div class="row">
    <div class="col-12">
      1. Text
      <br>
      2. <a href="/">Link</a>
      <br>
      3. <code>test</code>
      <br>
      4. <kbd>Ctrl</kbd>
      <br>
      5. <mark>highlight</mark>
      <br>
      6. <pre>pre content</pre>
    </div>
  </div>
</div>

<div class="container-fluid p-4 text-bg-dark">
  <div class="row">
    <div class="col-12">
      1. Text
      <br>
      2. <a href="/">Link</a>
      <br>
      3. <code>test</code>
      <br>
      4. <kbd>Ctrl</kbd>
      <br>
      5. <mark>highlight</mark>
      <br>
      6. <pre>pre content</pre>
    </div>
  </div>
</div>

<div class="container-fluid p-4 text-bg-secondary">
  <div class="row">
    <div class="col-12">
      1. Text
      <br>
      2. <a href="/">Link</a>
      <br>
      3. <code>test</code>
      <br>
      4. <kbd>Ctrl</kbd>
      <br>
      5. <mark>highlight</mark>
      <br>
      6. <pre>pre content</pre>
    </div>
  </div>
</div>

@louismaximepiton
Copy link
Member Author

This change looks good to me.

As said in the description, I also think we should mention somewhere in the documentation that those rules exist in order to be able to handle dark variants. Not a big fan of the place, but I'd said the most appropriate place is /docs/5.2/customize/color/. I let you propose something so that we can iterate on.

Tried to place it with Root variables and component explanation.

@sonarcloud
Copy link

sonarcloud bot commented Oct 12, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@julien-deramond julien-deramond merged commit 61a3d71 into main Oct 12, 2022
@julien-deramond julien-deramond deleted the main-lmp---dark-fix branch October 12, 2022 11:42
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.

*-dark
2 participants