Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
3fe48ff
feat(blocks): scaffold search-overlay block
laurelfulford May 13, 2026
49c9805
refactor(blocks): drop redundant block-theme guard in search-overlay
laurelfulford May 13, 2026
a3acfb2
feat(blocks): render search-overlay trigger button with block styles
laurelfulford May 13, 2026
f6bf4c9
refactor(blocks): thread blockClassName through search-overlay trigger
laurelfulford May 13, 2026
ba7b37d
feat(blocks): add overlay color control to search-overlay editor
laurelfulford May 13, 2026
32c3c57
refactor(blocks): hoist useMultipleOriginColorsAndGradients in search…
laurelfulford May 13, 2026
26ecc40
feat(blocks): render search-overlay trigger button server-side
laurelfulford May 13, 2026
605f520
refactor(blocks): drop unneeded output buffer in search-overlay render
laurelfulford May 13, 2026
fcca213
feat(blocks): render search-overlay panel with search form
laurelfulford May 14, 2026
11f99af
feat(blocks): hand off to Jetpack Instant Search when active
laurelfulford May 14, 2026
f30bedd
feat(blocks): style search-overlay trigger and panel
laurelfulford May 14, 2026
b5b79e9
refactor(blocks): make search-overlay panel respect theme tokens
laurelfulford May 14, 2026
ace3105
feat(blocks): add search-overlay open/close controller
laurelfulford May 14, 2026
b80e087
feat(blocks): trap focus and manage keyboard nav in search overlay
laurelfulford May 14, 2026
49c651d
feat(blocks): fade search overlay in and out
laurelfulford May 14, 2026
bbc5542
refactor(blocks): move search-overlay color into the Color panel
laurelfulford May 14, 2026
453ab23
refactor(blocks): align search-overlay panel SCSS with overlay-menu
laurelfulford May 14, 2026
b60c99d
fix(blocks): drop newspack-icon-close from search-overlay close button
laurelfulford May 14, 2026
feaaeea
feat(blocks): polish search-overlay close button and scrim interaction
laurelfulford May 14, 2026
4de78c7
refactor(blocks): render search-overlay markup with PHP templates
laurelfulford May 14, 2026
1e19631
refactor(blocks): default search-overlay panel to a translucent scrim
laurelfulford May 14, 2026
4f53e16
refactor(blocks): mirror block-theme search overlay nuance
laurelfulford May 14, 2026
2c35533
fix: applying review feedback
laurelfulford May 18, 2026
3fd1c8a
fix: add tests
laurelfulford May 18, 2026
704c243
fix: avoid issues with the focus callback firing after the overlay is…
laurelfulford May 18, 2026
85e5f72
feat(block-theme): rename to Overlay Search; polish defaults
thomasguillot May 22, 2026
9e17078
refactor(block-theme): drop default palette on Overlay Search
thomasguillot May 22, 2026
35e972e
refactor(block-theme): drop icon-only aspect-ratio on Overlay Search
thomasguillot May 22, 2026
c2e7ff5
refactor(block-theme): defer SVG sizing to .wp-block-button rule
thomasguillot May 22, 2026
2c2bae3
fix(block-theme): wrap overlay-menu trigger in .wp-block-button
thomasguillot May 22, 2026
56d78f0
refactor(block-theme): use Newspack_UI_Icons for overlay block icons
thomasguillot May 22, 2026
4f3eb24
fix(block-theme): default overlay-menu panel colors via block.json
thomasguillot May 22, 2026
359ef64
fix(block-theme): use Newspack UI neutral token for overlay scrim
thomasguillot May 22, 2026
c3c2318
fix(block-theme): add block theme var as first scrim fallback
thomasguillot May 22, 2026
5ab88f9
fix(block-theme): align overlay-menu scrim with overlay-search var chain
thomasguillot May 22, 2026
704bc89
fix(block-theme): keep overlay-search panel below wp-admin toolbar
thomasguillot May 22, 2026
83da487
fix(block-theme): swap overlay-search close button rems for tokens
thomasguillot May 22, 2026
c67a0e5
fix(block-theme): bump overlay-search close icon to 24px via token
thomasguillot May 22, 2026
9f09461
fix(block-theme): offset overlay-search panel below wp admin bar
thomasguillot May 22, 2026
fa94702
fix(block-theme): center overlay-search close icon with grid
thomasguillot May 22, 2026
c43bfd4
fix(block-theme): add visible focus ring to overlay-search close
thomasguillot May 22, 2026
2285c3a
fix(block-theme): radius + block svg on overlay-search close
thomasguillot May 22, 2026
c962eb8
refactor(block-theme): drop redundant overlay-search trigger flex rules
thomasguillot May 22, 2026
96a0f89
refactor(block-theme): drop redundant overlay-menu trigger flex rules
thomasguillot May 22, 2026
e8bd7b6
fix(block-theme): align overlay-menu admin bar offset and stacking
thomasguillot May 22, 2026
0164789
fix(block-theme): match overlay-menu close polish to overlay-search
thomasguillot May 22, 2026
3eee171
fix(block-theme): size and color overlay-menu close icon svg
thomasguillot May 22, 2026
b9cc6e3
fix(block-theme): drop redundant aria-label and align content-size fa…
thomasguillot May 22, 2026
c031f2f
fix(block-theme): enqueue commons + use wp-dom-ready + per-panel sear…
thomasguillot May 22, 2026
6fd9eaf
feat(block-theme): scale overlay-menu slide duration with panel width
thomasguillot May 22, 2026
f6b0e86
fix(block-theme): switch close-icon contrast to APCA, recompute on open
thomasguillot May 22, 2026
ab7ab42
fix(block-theme): sanitize overlay-menu panel inline styles + mock do…
thomasguillot May 22, 2026
add2236
fix(block-theme): keep overlay-menu trigger labeled when text is empty
thomasguillot May 22, 2026
48c5000
fix(block-theme): match overlay-search editor trigger classes to fron…
thomasguillot May 22, 2026
2bdd615
fix(block-theme): add fallbacks to panel color defaults and tighten t…
thomasguillot May 22, 2026
16032b3
fix(block-theme): soften panel text color fallback to #1E1E1E
thomasguillot May 22, 2026
c769f22
refactor(blocks): move style registration to block.json
thomasguillot May 26, 2026
c119842
fix(blocks): lock overlay-menu trigger and panel against move/remove
thomasguillot May 26, 2026
59fb57d
fix: update tests based on feedback
laurelfulford May 27, 2026
305953f
fix: use print_svg() function
laurelfulford May 27, 2026
4fcac57
fix: remove unneeded props
laurelfulford May 28, 2026
4f8b255
fix: use wp_unique_id prefix and defer until neede
laurelfulford May 28, 2026
c4a2602
fix: remove unneeded esc_url()
laurelfulford May 28, 2026
27bd3af
fix: remove unneeded data-overlay-id
laurelfulford May 28, 2026
db4b4e8
fix: use trigger text as dialog aria-label
laurelfulford May 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions includes/class-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static function init() {
require_once NEWSPACK_ABSPATH . 'src/blocks/overlay-menu/class-overlay-menu-block.php';
require_once NEWSPACK_ABSPATH . 'src/blocks/overlay-menu/trigger/class-overlay-menu-trigger-block.php';
require_once NEWSPACK_ABSPATH . 'src/blocks/overlay-menu/panel/class-overlay-menu-panel-block.php';
require_once NEWSPACK_ABSPATH . 'src/blocks/overlay-search/class-overlay-search-block.php';
Social_Icons::init();
}
if ( Collections::is_module_active() ) {
Expand Down
4 changes: 4 additions & 0 deletions includes/class-newspack-ui-icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ public static function sanitize_svgs() {
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--newspack">
<path d="M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18m1.773 13.09-4.228-4.226v4.227H7.91V7.909l8.182 8.182zm2.318-2.317-1.227-1.228h1.227zm0-2.318h-2.318l-1.228-1.228h3.546zm0-2.319h-4.636L10.227 7.91h5.864z" />
</svg>',
'search' =>
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--search">
<path d="M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" />
</svg>',
'people' =>
'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true" focusable="false" class="newspack-ui__svg-icon--people">
<path d="M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z" fill-rule="evenodd" />
Expand Down
3 changes: 3 additions & 0 deletions src/blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import * as copyrightDate from './copyright-date';
import * as overlayMenu from './overlay-menu';
import * as overlayMenuTrigger from './overlay-menu/trigger';
import * as overlayMenuPanel from './overlay-menu/panel';
import * as overlaySearch from './overlay-search';

/**
* Block Scripts
Expand All @@ -47,6 +48,7 @@ export const blocks = [
overlayMenu,
overlayMenuTrigger,
overlayMenuPanel,
overlaySearch,
];

const readerActivationBlocks = [ 'newspack/reader-registration', 'newspack/my-account-button' ];
Expand All @@ -64,6 +66,7 @@ const blockThemeBlocks = [
'newspack/overlay-menu-trigger',
'newspack/overlay-menu-panel',
'newspack/my-account-button',
'newspack/overlay-search',
];

/**
Expand Down
5 changes: 5 additions & 0 deletions src/blocks/my-account-button/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
},
"shadow": true
},
"styles": [
{ "name": "default", "label": "Default", "isDefault": true },
{ "name": "icon-only", "label": "Icon only" },
{ "name": "text-only", "label": "Text only" }
],
"editorStyle": "file:../../../dist/blocks.css",
"style": "file:../../../dist/blocks.css"
}
Expand Down
18 changes: 0 additions & 18 deletions src/blocks/my-account-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,12 @@ import './style.scss';
/**
* WordPress dependencies
*/
import { registerBlockStyle } from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';
import { button as icon } from '@wordpress/icons';

const { name } = metadata;

export { metadata, name };

registerBlockStyle( name, {
name: 'default',
label: __( 'Default', 'newspack-plugin' ),
isDefault: true,
} );

registerBlockStyle( name, {
name: 'icon-only',
label: __( 'Icon only', 'newspack-plugin' ),
} );

registerBlockStyle( name, {
name: 'text-only',
label: __( 'Text only', 'newspack-plugin' ),
} );

export const settings = {
title: metadata.title,
icon: {
Expand Down
4 changes: 4 additions & 0 deletions src/blocks/overlay-menu/class-overlay-menu-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public static function register_block() {
* @return string Block HTML.
*/
public static function render_block( array $attributes, string $content ) {
// The compiled view script depends on dist/commons.js (a webpack split chunk).
// Ensure commons is enqueued so the entry callback can execute on the frontend.
\Newspack\Newspack::load_common_assets();

$instance_id = esc_attr( $attributes['instanceId'] ?? '' );

// Only add data-overlay-id when instanceId is set to avoid empty selectors.
Expand Down
6 changes: 5 additions & 1 deletion src/blocks/overlay-menu/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
import PanelPreviewToggle from './panel-preview-toggle';
import { panelToggles, subscribeToPanel } from './preview-refs';

const BLOCKS_TEMPLATE = [ [ 'newspack/overlay-menu-trigger' ], [ 'newspack/overlay-menu-panel' ] ];
const CHILD_LOCK = { move: true, remove: true };
const BLOCKS_TEMPLATE = [
[ 'newspack/overlay-menu-trigger', { lock: CHILD_LOCK } ],
[ 'newspack/overlay-menu-panel', { lock: CHILD_LOCK } ],
];

/**
* Edit component for the Overlay Menu block.
Expand Down
7 changes: 4 additions & 3 deletions src/blocks/overlay-menu/panel/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@
},
"panelBackgroundColor": {
"type": "string",
"default": ""
"default": "var(--wp--preset--color--base, #ffffff)"
},
"panelTextColor": {
"type": "string",
"default": ""
}
"default": "var(--wp--preset--color--contrast, #1E1E1E)"
},
"lock": { "type": "object", "default": { "move": true, "remove": true } }
},
"supports": {
"html": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
*/
final class Overlay_Menu_Panel_Block {

// Inline SVG for the close icon.
const ICON_CLOSE = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"/></svg>';

/**
* Initializes the block.
*
Expand Down Expand Up @@ -74,12 +71,20 @@ public static function render_block( array $attributes, string $content, \WP_Blo
$panel_class = 'overlay-menu__panel is-layout-constrained overlay-menu__panel--' . $direction . ' overlay-menu__panel--width--' . $panel_width;
}

// Run user-supplied color values through `safecss_filter_attr` so
// `;`-delimited declaration injection is stripped (esc_attr alone wouldn't).
$panel_styles = [];
if ( $panel_bg_color ) {
$panel_styles[] = 'background:' . esc_attr( $panel_bg_color );
$safe_bg = safecss_filter_attr( 'background: ' . $panel_bg_color );
if ( '' !== $safe_bg ) {
$panel_styles[] = $safe_bg;
}
}
if ( $panel_text_color ) {
$panel_styles[] = 'color:' . esc_attr( $panel_text_color );
$safe_color = safecss_filter_attr( 'color: ' . $panel_text_color );
if ( '' !== $safe_color ) {
$panel_styles[] = $safe_color;
}
Comment thread
thomasguillot marked this conversation as resolved.
}
$extra_attributes = [
'id' => 'newspack-overlay-panel-' . $instance_id,
Expand All @@ -105,7 +110,7 @@ public static function render_block( array $attributes, string $content, \WP_Blo
class="overlay-menu__close"
>
<span class="overlay-menu__icon" aria-hidden="true">
<?php echo self::ICON_CLOSE; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
<?php \Newspack\Newspack_UI_Icons::print_svg( 'close' ); ?>
</span>
<span class="screen-reader-text">
<?php esc_html_e( 'Close', 'newspack-plugin' ); ?>
Expand Down
85 changes: 35 additions & 50 deletions src/blocks/overlay-menu/style.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
@use "../../newspack-ui/scss/variables/breakpoints";
@use "../../../packages/colors/colors.module" as colors;

.wp-block-newspack-overlay-menu {
.overlay-menu__trigger {
align-items: center;
cursor: pointer;
display: inline-flex;
gap: var( --wp--preset--spacing--20 );
justify-content: center;
}

// ─── Block editor only ────────────────────────────────────────────────────

// Hidden panel state — keeps InnerBlocks in the DOM without being visible.
Expand All @@ -22,26 +15,11 @@
// when the menu opens, removing it from the .wp-block-newspack-overlay-menu
// ancestor. Styles nested inside the block wrapper would stop matching.

// Icon used in trigger + close buttons.
.overlay-menu__icon {
align-items: center;
display: inline-flex;
flex-shrink: 0;
height: 1.25em;
width: 1.25em;

svg {
fill: currentcolor;
height: 100%;
width: 100%;
}
}

// Close button wrapper — sits at the top of the panel, flush right.
.overlay-menu__close-wrapper {
align-items: center;
display: flex;
height: var( --wp--custom--spacing--85, 3rem );
height: var( --wp--custom--spacing--85, 4rem );
justify-content: flex-end;
margin-right: calc( -1 * var( --wp--preset--spacing--30 ) );

Expand All @@ -55,13 +33,26 @@
align-items: center;
background: none;
border: none;
border-radius: var( --wp--custom--border--radius-small, 0.25rem );
color: inherit;
cursor: pointer;
display: inline-flex;
font-family: inherit;
font-size: inherit;
gap: var( --wp--preset--spacing--10, 0.25rem );
gap: var( --wp--custom--spacing--10, 0.25rem );
padding: var( --wp--preset--spacing--20 );

&:focus-visible {
outline: 2px solid;
outline-offset: 1px;
}

svg {
display: block;
width: var( --wp--preset--spacing--40, 1.5rem );
height: var( --wp--preset--spacing--40, 1.5rem );
fill: currentcolor;
}
Comment thread
thomasguillot marked this conversation as resolved.
}

// Panel content area.
Expand All @@ -74,37 +65,31 @@
// no dependency on the theme's overlay-contents classes.

.overlay-menu__panel {
background: var( --wp--preset--color--base, #fff );
// Slide duration scales with the panel width via per-modifier overrides below.
--overlay-menu-slide-duration: 250ms;

bottom: 0;
opacity: 0;
overflow-y: auto;
padding: var( --wp--preset--spacing--30, 1rem );
position: fixed;
top: 0;
top: var(--wp-admin--admin-bar--height, 0);
// Transition driven by CSS; JS only toggles the --open class.
transition:
opacity 125ms ease-in-out,
left 250ms ease-in-out,
right 250ms ease-in-out,
top 250ms ease-in-out,
bottom 250ms ease-in-out,
transform 250ms ease-in-out;
left var(--overlay-menu-slide-duration) ease-in-out,
right var(--overlay-menu-slide-duration) ease-in-out,
top var(--overlay-menu-slide-duration) ease-in-out,
bottom var(--overlay-menu-slide-duration) ease-in-out,
transform var(--overlay-menu-slide-duration) ease-in-out;
max-width: 90vw;
width: 100%;
z-index: 50;
z-index: 99998;

@media ( min-width: breakpoints.$tablet_width ) {
padding: var( --wp--preset--spacing--40, 1.5rem );
}

.admin-bar & {
top: 46px;

@media ( min-width: breakpoints.$tablet_width ) {
top: 32px;
}
}

// Side panels slide in from left or right.
&--left {
left: -100%;
Expand All @@ -121,7 +106,7 @@
left: 0;
max-width: 100%;
right: 0;
transition: opacity 125ms ease-in-out, visibility 0s 125ms;
transition: opacity 200ms ease-in-out, visibility 0s 200ms;
visibility: hidden;
}

Expand All @@ -139,7 +124,7 @@
}

&.overlay-menu__panel--full-screen {
transition: opacity 125ms ease-in-out, visibility 0s;
transition: opacity 200ms ease-in-out, visibility 0s;
visibility: visible;
}
}
Expand All @@ -156,26 +141,26 @@
}
}

&--width--x-small { @include panel-width( --wp--custom--width--x-small, 300px ); }
&--width--small { @include panel-width( --wp--custom--width--small, 410px ); }
&--width--x-small { @include panel-width( --wp--custom--width--x-small, 300px ); --overlay-menu-slide-duration: 250ms; }
&--width--small { @include panel-width( --wp--custom--width--small, 410px ); --overlay-menu-slide-duration: 275ms; }
// Medium intentionally maps to the theme's content size (from theme.json), not the --wp--custom--width-- family used by the other sizes.
&--width--medium { @include panel-width( --wp--style--global--content-size, 632px ); }
&--width--large { @include panel-width( --wp--custom--width--large, 964px ); }
&--width--x-large { @include panel-width( --wp--custom--width--x-large, 1296px ); }
&--width--medium { @include panel-width( --wp--style--global--content-size, 632px ); --overlay-menu-slide-duration: 325ms; }
&--width--large { @include panel-width( --wp--custom--width--large, 964px ); --overlay-menu-slide-duration: 400ms; }
&--width--x-large { @include panel-width( --wp--custom--width--x-large, 1296px ); --overlay-menu-slide-duration: 475ms; }
}

// ─── Scrim ────────────────────────────────────────────────────────────────────
// Shared by both the frontend (created dynamically by view.js) and the block
// editor preview (rendered as a React fragment sibling in edit.js).

.overlay-menu__scrim {
background: rgba( 0, 0, 0, 0.5 );
background: var(--wp--custom--color--neutral-70, var(--newspack-ui-color-neutral-70, #{colors.$neutral-700}));
cursor: pointer;
inset: 0;
margin: 0 !important;
position: fixed;
transition: opacity 500ms ease-in-out;
z-index: 49;
z-index: 99997;
}

// Lock document scrolling while any overlay menu instance is open.
Expand Down
8 changes: 7 additions & 1 deletion src/blocks/overlay-menu/trigger/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"parent": [ "newspack/overlay-menu" ],
"usesContext": [ "newspack-overlay-menu/instanceId" ],
"attributes": {
"triggerText": { "type": "string", "default": "Menu" }
"triggerText": { "type": "string", "default": "Menu" },
"lock": { "type": "object", "default": { "move": true, "remove": true } }
},
"supports": {
"html": false,
Expand All @@ -34,6 +35,11 @@
}
}
},
"styles": [
{ "name": "default", "label": "Default", "isDefault": true },
{ "name": "icon-only", "label": "Icon only" },
{ "name": "text-only", "label": "Text only" }
],
"editorStyle": "file:../../../../dist/blocks.css",
"style": "file:../../../../dist/blocks.css"
}
Loading
Loading