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

Add data attr selector for dark mode navbars #38522

Merged
merged 2 commits into from
May 19, 2023
Merged

Add data attr selector for dark mode navbars #38522

merged 2 commits into from
May 19, 2023

Conversation

mdo
Copy link
Member

@mdo mdo commented Apr 28, 2023

Fixes #38363, I think. We advise folks to use the data-bs-theme selectors for toggling dark mode on some components, but when using the media-query type for color modes, the selectors aren't available. So we need to include something like this branch proposes.

/cc @julien-deramond for ideas on if there's a better approach here.

@mdo mdo requested a review from a team as a code owner April 28, 2023 02:40
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.

TBH I don't see another way of tackling it for now.

However, when I try your change locally with $color-mode-type set to media-query, I can see a weird rendering in light mode of the first example in /docs/5.3/components/navbar/#color-schemes because of .bg-body-secondary (the background color is too light).

Screenshot 2023-05-02 at 22 42 47

Moreover, we have

<nav class="navbar navbar-expand-lg bg-body-secondary" data-bs-theme="dark">

And then, the corresponding markup is shown right-after is with .bg-dark 🤔
<nav class="navbar bg-dark" data-bs-theme="dark">

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.

LGTM! 🚀

@mdo mdo merged commit a6dc107 into main May 19, 2023
@mdo mdo deleted the navbar-dark-mode branch May 19, 2023 16:05
romankupchak93 pushed a commit to romankupchak93/bootstrap that referenced this pull request Jan 5, 2024
* Add data attr selector for dark mode navbars

* Fix dark example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Navbar with dark background has wrong text color when using media-query color mode type
2 participants