Repository navigation
feat(theme): render Button blocks as the theme's default button - #77
Merged
Merged
Conversation
Buttons inserted with the block editor's Button block rendered as WP's default grey pill, or in whatever colour the author picked, and inside WPBakery lesson tabs the course-content link rule (navy, bold, underline, !important) painted their label navy-on-navy. - New components/_block-buttons.scss: every .wp-block-button__link renders as .button.primary.medium (navy, white uppercase 800 text, square, 12px/16px, inverting on hover). Colour, gradient, border, radius, padding, typography and the Outline style are overridden with !important so buttons stay uniform; authors only control alignment and width. - .wp-block-buttons gets a flex/gap fallback (and hides wpautop's stray empty <p>/<br>), since WPBakery-wrapped content loses WP's generated layout classes. - div.vc_tta-panel-body link rules now skip .wp-block-button__link. - Same rules compiled to dist/editor/editor-style.css and loaded in the block editor via enqueue_block_assets, so authors see the real button. - Bump ACADEMY_AFRICA_VERSION to 1.7.21 for cache busting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Buttons added with the block editor's Button block didn't match the site:
div.vc_tta-panel-body a:link { color: navy !important }(the course-content link style) painted the label navy, so it was invisible on a navy background. It also added underline/bold and a red hover.wpautopand strips WP's generated button-group layout classes, so grouped buttons touched each other and the stray empty<p>added a phantom gap.Change
components/_block-buttons.scss(new, inmain.css): every.wp-block-button__linkrenders as the theme's.button.primary.medium. That's navy#0C1A81, white uppercase 800-weight text, square corners, 12px/16px padding, inverting toprimary-50/navy on hover, plus a focus-visible ring.!important. WP's palette classes are!importantthemselves and custom values are inline styles, so this is the only way to keep buttons uniform. Authors control only alignment and width, which live on the wrapper and aren't touched..wp-block-buttonsgets aflex/gap: 8pxfallback and hides wpautop's empty<p>/<br>._wpbakery.scss: the course-content link rules now use:not(.wp-block-button__link), so they keep styling text links only.dist/editor/editor-style.css, loaded in the block editor viaenqueue_block_assets(admin only), so authors see the real button. That sheet imports only the colour variables, so it doesn't leak.button/.wysiwyginto wp-admin.ACADEMY_AFRICA_VERSIONbumped to1.7.21for cache busting.main.cssonly gains the new rules. The only selectors changed are the twovc_tta-panel-bodylink rules.Testing (local Docker)
On Advanced Fact-checking Technology (inside a WPBakery tour tab), I injected buttons with: no styles, the Outline style, a palette colour (orange), inline custom colour/border/radius/padding/font-size, and a gradient. In headless Chrome all of them computed identically: white text on
#0C1A81, 1px navy border, 0 radius, 12px/16px, 16px/800 uppercase, no underline. I also took a screenshot to confirm visually.php -lpasses onfunctions.php.Not yet verified: the button's appearance inside the block editor and the hover state on screen. Please check both on staging.
Note for content editors
Colour and style pickers on the Button block no longer have any effect on the front end. Buttons always use the house style. A button still needs a link (⌘K) to do anything; the existing Download button on that topic has no
href.