Skip to content

fix(bricks): restore theme toggle in Bricks 2.4 - #35

Merged
DavidBabinec merged 1 commit into
CoreBunch:mainfrom
Jan-CoreBunch:fix/bricks-theme-toggle-button
Sep 26, 2026
Merged

DavidBabinec merged 1 commit into
CoreBunch:mainfrom
Jan-CoreBunch:fix/bricks-theme-toggle-button

Conversation

@Jan-CoreBunch

Copy link
Copy Markdown
Contributor

What

Restores the Core Framework dark/light preview toggle in Bricks 2.4 while preserving compatibility with the legacy toolbar. The toggle uses its own accessible markup, stays after sibling controls using CSS order, and remounts after toolbar changes without duplicating buttons or listeners. Theme state is synchronized on initialization and iframe loads.

Includes the rebuilt packages/wp/assets/public/js/bricks_builder.js using the existing esbuild settings.

Why

Bricks 2.4 uses .bricks-toolbar with position-specific IDs, so the old #bricks-toolbar lookup exits without inserting the toggle. Cloning a native button also copies its inline CSS order, which means appending it does not put it visually last. Bricks can recreate toolbars when its interface layout changes.

Verification

  • bun run test:www: 25 suites and 156 tests passed.
  • node --check packages/wp/assets/public/js/bricks_builder.js: passed.
  • git diff --check: passed before committing.
  • 16 local DOM checks passed, covering legacy and current markup, toolbar positions, delayed insertion, toolbar/iframe replacement, sibling ordering, hidden groups, duplicate prevention, keyboard interaction, disabled preferences, and saved/automatic themes. The temporary local harness is not included in this PR.
  • Live Bricks 2.4: confirmed the toggle appears last, mouse and keyboard activation switch the builder and canvas, and opening/cancelling the interface customizer leaves one toggle. No Core Framework console errors.
  • Verified the generated script exactly matches the source.
  • The full builder TypeScript check reports two pre-existing errors in oxygen6_builder.ts (TS2550 at line 1059 and TS2531 at line 1516), also reproduced against the unchanged base. Excluding that unchanged file, the builder type check passes.

@DavidBabinec
DavidBabinec merged commit 3b389f1 into CoreBunch:main Sep 26, 2026
6 checks passed
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