Fix settings dark mode toggle double-binding and center it (#197)
topbar.js binds click handlers to every .dark-toggle, including the settings one; settings.js then also wired a delegation that re-clicked the topbar button, so each click flipped dark mode twice (net no-op). Mark buttons as wired in topbar.js and only add a fallback handler in settings.js when topbar.js did not run. CSS: center the toggle horizontally under the Settings title with auto margins, matching .settings-body padding. Closes #197
This commit is contained in:
@@ -31,6 +31,9 @@
|
||||
apply();
|
||||
sync(Array.prototype.slice.call(btns));
|
||||
btns.forEach(function (b) {
|
||||
// mark as wired so settings.js does not add a second handler
|
||||
// (#197: double-binding made the settings toggle flip twice = no-op)
|
||||
b.dataset.darkWired = '1';
|
||||
b.addEventListener('click', function () {
|
||||
var s = state();
|
||||
var dark = !s.dark;
|
||||
|
||||
Reference in New Issue
Block a user