bootstrap
                                
                                 bootstrap copied to clipboard
                                
                                    bootstrap copied to clipboard
                            
                            
                            
                        Dark theme fixes for navbar and dropdown (Fixes #39984)
Description
- Allow data-bs-theme="dark"on parent element of.navbarto trigger.navbar-darkvariables as described in the documentation.
- Allow data-bs-theme="dark"on parent or current element of.dropdown-menuto trigger.dropdown-menu-darkvariables as described in the documentation.
Motivation & Context
Closes #39984
Type of changes
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Refactoring (non-breaking change)
- [ ] Breaking change (fix or feature that would change existing functionality)
Checklist
- [x] I have read the contributing guidelines
- [x] My code follows the code style of the project (using npm run lint)
- [ ] My change introduces changes to the documentation
- [ ] I have updated the documentation accordingly
- [ ] I have added tests to cover my changes
- [ ] All new and existing tests passed
Live previews
- https://deploy-preview-39989--twbs-bootstrap.netlify.app/docs/5.3/components/dropdowns/
- https://deploy-preview-39989--twbs-bootstrap.netlify.app/docs/5.3/components/navbar/
Related issues
#39984, #39291
@julien-deramond I'm not sure how the last navbar could be fixed if the background color is set with a style tag, there doesn't seem to be anything to work off of there?
In 5.3 without this PR's change if I remove bg-primary from the second navbar and manually set the background color with a style the text also renders white in dark mode.
I've checked rapidly, but there is a forced data-bs-theme="light" (that should be displayed in the markup of the documentation, by the way). In this case, the color should be black since the light mode is forced.
I'll need to find the time to check all the existing PRs and issues at the same time regarding the color modes, because this could be also fixed automatically by https://github.com/twbs/bootstrap/pull/39295 if the color: is set by default (not the case right now).
Yeah I'm not really sure what to do here. Maybe CSS specificity is winning?