Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !38065

Nesting light mode components under dark mode

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Mark Otto requested to merge carousel-nested-color-modes into main Feb 15, 2023
  • Overview 5
  • Commits 1
  • Pipelines 0
  • Changes 1

Something we've overlooked is how to properly nest light mode inside a parent dark mode. I ran into this while updating the examples to better support color modes. Basically, if you have the root set to dark mode and you want something like our carousel to appear in light mode, doing the following won't work:

<html data-bs-theme="dark">
  <div class="carousel" data-bs-theme="light">...</div>
</html>

This is because we have no selector for [data-bs-theme="dark"] .carousel { ... } in our codebase. We only have .carousel { ... }. As such, this PR suggests a potential solution we could use across the carousel component and other components: use a :not() selector in the selector.

@if $enable-dark-mode {
  @include color-mode(dark) {
    .carousel:not([data-bs-theme="light"]) {
      @include carousel-dark();
    }
  }
}

The same changes might need to be applied to accordions, dropdowns, close button, navbars, form checks, and form selects (all places we call the color mode mixin right now).

Thoughts?

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: carousel-nested-color-modes