Skip to content

fix(input_dark_mode): correct light-mode assignment typo in connectedCallback - #1349

Merged
gadenbuie merged 5 commits into
mainfrom
fix/input-dark-mode-light-typo
Aug 25, 2026
Merged

fix(input_dark_mode): correct light-mode assignment typo in connectedCallback#1349
gadenbuie merged 5 commits into
mainfrom
fix/input-dark-mode-light-typo

Conversation

@gadenbuie

Copy link
Copy Markdown
Member

Summary

  • BslibInputDarkMode.connectedCallback() had this.mode == "light" (a comparison, not an assignment) in the branch that handles connecting when document.documentElement already has data-bs-theme="light".
  • As a result this.mode stayed undefined, and reflectPreference() wrote the literal string "undefined" into data-bs-theme on <html>. The rendered icon still looked correct (Bootstrap has no explicit rule for anything other than [data-bs-theme="dark"]), but the attribute value was invalid and the button's aria-label/title read "Switch from undefined to light mode" until the first click.
  • Fixed the typo (===) and rebuilt the web-components bundle.

Test plan

  • bslib::page_fillable(bslib::input_dark_mode(style = "display: none"), bslib::input_dark_mode()), confirm data-bs-theme stays "light" (not "undefined") and the visible toggle's label reads "Switch from light to dark mode" on load.

gadenbuie and others added 5 commits August 20, 2026 11:48
…ght preference

The existing-light branch in connectedCallback() used `==` instead of
`=`, so this.mode stayed undefined and reflectPreference() wrote the
literal string "undefined" to data-bs-theme.
@gadenbuie
gadenbuie requested a review from cpsievert August 21, 2026 15:59
@gadenbuie
gadenbuie merged commit 6935d98 into main Aug 25, 2026
@gadenbuie
gadenbuie deleted the fix/input-dark-mode-light-typo branch August 25, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants