Description
This PR checks in color-mode.js
that the themeSwitcher
var is not null
before continuing the algorithm.
Motivation & Context
This avoids an error message in the console when one goes to any examples in our doc (e.g. https://twbs-bootstrap.netlify.app/docs/5.3/examples/heroes/) either in light or dark mode:
Uncaught TypeError: btnToActive is null
showActiveTheme https://twbs-bootstrap.netlify.app/docs/5.3/assets/js/color-modes.js:35
<anonymous> https://twbs-bootstrap.netlify.app/docs/5.3/assets/js/color-modes.js:60
color-modes.js:35:28
This is because our examples react to the theme being light or dark via color-modes.js
, but they don't have any dropdown switcher on the page (like in the header for other pages).
Type of changes
-
Bug fix (non-breaking change which fixes an issue)
Checklist
-
I have read the contributing guidelines -
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 - (N/A) I have added tests to cover my changes
-
All new and existing tests passed
Live previews
- https://deploy-preview-38074--twbs-bootstrap.netlify.app/docs/5.3/examples/heroes/ (or any other example)