From 33f7d135aab6ed4d24c0ac91cfd1c0d352e3bea1 Mon Sep 17 00:00:00 2001 From: mricoul Date: Thu, 26 Mar 2026 15:44:02 +0100 Subject: [PATCH 1/6] chore(blueprint): update demo page creation and landing page Fixes the broken PHP script in the blueprint and uses base64 encoding for the demo page content to prevent escaping issues. Updates the landing page to point directly to the newly created demo page. --- blueprint.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blueprint.json b/blueprint.json index 1ae7783..0b67c06 100644 --- a/blueprint.json +++ b/blueprint.json @@ -1,6 +1,6 @@ { "$schema": "https://playground.wordpress.net/blueprint-schema.json", - "landingPage": "/wp-admin/post.php?post=4&action=edit", + "landingPage": "/blockparty-modal-demo/", "preferredVersions": { "php": "8.1", "wp": "latest" @@ -26,7 +26,7 @@ }, { "step": "runPHP", - "code": "\n
\n\n
\n\n\n\n

My Modal

\n

Blockparty Modal is a WordPress plugin that lets you add accessible modal dialogs to your content via the Gutenberg block editor. You define the modal content and behaviour in the editor; on the frontend, the modal is shown when the user activates a linked trigger (such as a button block).

\n
\n'; $page_id = wp_insert_post(array('post_title' => 'Blockparty Modal', 'post_content' => $page_content, 'post_status' => 'publish', 'post_type' => 'page')); echo 'Page created with ID: ' . $page_id; ?>'; $page_id = wp_insert_post(array('post_title' => 'Blockparty Modal', 'post_content' => $page_content, 'post_status' => 'publish', 'post_type' => 'page')); echo 'Page created with ID: ' . $page_id; ?>" + "code": " 'Blockparty Modal',\n\t'post_name' => 'blockparty-modal-demo',\n\t'post_content' => $page_content,\n\t'post_status' => 'publish',\n\t'post_type' => 'page',\n) );\necho 'Page created with ID: ' . $page_id;\n?>" } ] } From 86833b3d68e29f68c64d91c204ca477421235421 Mon Sep 17 00:00:00 2001 From: mricoul Date: Thu, 26 Mar 2026 15:50:54 +0100 Subject: [PATCH 2/6] chore(blueprint): simplify accessibility classes and remove deprecated code Replaces the dual `screen-reader-text sr-only` classes with a localized `sr-only` class and corresponding CSS to reduce external dependencies. Removes the deprecated block version and applies general code style formatting updates across the modal components. --- src/blockparty-modal/block.json | 11 +--- src/blockparty-modal/deprecated.js | 74 --------------------------- src/blockparty-modal/edit.js | 8 +-- src/blockparty-modal/index.js | 82 +++++++++++++++--------------- src/blockparty-modal/save.js | 6 +-- src/blockparty-modal/style.scss | 14 +++++ 6 files changed, 58 insertions(+), 137 deletions(-) delete mode 100644 src/blockparty-modal/deprecated.js diff --git a/src/blockparty-modal/block.json b/src/blockparty-modal/block.json index 9b0b3a8..a81fc3b 100644 --- a/src/blockparty-modal/block.json +++ b/src/blockparty-modal/block.json @@ -26,11 +26,7 @@ "closedBy": { "type": "string", "default": "any", - "enum": [ - "any", - "closerequest", - "none" - ] + "enum": [ "any", "closerequest", "none" ] }, "enableCloseButton": { "type": "boolean", @@ -47,10 +43,7 @@ }, "example": {}, "supports": { - "align": [ - "wide", - "full" - ], + "align": [ "wide", "full" ], "dimensions": { "height": true, "minHeight": true diff --git a/src/blockparty-modal/deprecated.js b/src/blockparty-modal/deprecated.js deleted file mode 100644 index a44d79d..0000000 --- a/src/blockparty-modal/deprecated.js +++ /dev/null @@ -1,74 +0,0 @@ -/** - * Prior save output for validation of existing post content. - * - * @see https://developer.wordpress.org/block-editor/reference-guides/block-api/block-deprecation/ - */ -import { __ } from '@wordpress/i18n'; -import { useBlockProps, InnerBlocks, RichText } from '@wordpress/block-editor'; -import { Icon, close } from '@wordpress/icons'; - -const MODAL_ID_PREFIX = 'modal-'; - -/** - * Save markup before `screen-reader-text` was added to the close label span (v1.0.4+). - * - * @param {Object} props Block props. - * @param {Object} props.attributes Block attributes. - * @return {JSX.Element} Element to render. - */ -function saveV1CloseLabelSrOnly( { attributes } ) { - const { - closedBy, - displayIconOnly, - enableCloseButton, - headingLevel: HeadingTag, - modalId, - preventScroll, - title, - } = attributes; - - const dialogId = modalId ? MODAL_ID_PREFIX + modalId : undefined; - const customProps = {}; - - if ( preventScroll ) { - customProps.className = 'wp-block-blockparty-modal--prevent-scroll'; - } - - return ( - -
- -
-
- -
- { enableCloseButton && closedBy !== 'none' && ( - - ) } -
- ); -} - -export default [ - { - save: saveV1CloseLabelSrOnly, - }, -]; diff --git a/src/blockparty-modal/edit.js b/src/blockparty-modal/edit.js index aab2bf6..90c72e5 100644 --- a/src/blockparty-modal/edit.js +++ b/src/blockparty-modal/edit.js @@ -209,13 +209,7 @@ export default function Edit( { clientId, attributes, setAttributes } ) { type="button" className="wp-block-blockparty-modal__close-button" > - + { __( 'Close this dialog window', 'blockparty-modal' diff --git a/src/blockparty-modal/index.js b/src/blockparty-modal/index.js index 691889d..78a4b7a 100644 --- a/src/blockparty-modal/index.js +++ b/src/blockparty-modal/index.js @@ -18,7 +18,6 @@ import './style.scss'; import Edit from './edit'; import save from './save'; -import deprecated from './deprecated'; import metadata from './block.json'; import { @@ -28,12 +27,11 @@ import { addLinkedModalAttribute, } from './utils'; -registerBlockType( metadata.name, { +registerBlockType(metadata.name, { icon: modal, edit: Edit, save, - deprecated, -} ); +}); /** * Returns the list of block names allowed as modal triggers (same as filter blockparty_modal_trigger_allowed_blocks). @@ -43,11 +41,11 @@ registerBlockType( metadata.name, { */ function getModalTriggerAllowedBlocks() { try { - const settings = select( 'core/block-editor' ).getSettings(); + const settings = select('core/block-editor').getSettings(); const list = settings?.blockpartyModalTriggerAllowedBlocks; - return Array.isArray( list ) ? list : [ 'core/button' ]; + return Array.isArray(list) ? list : ['core/button']; } catch { - return [ 'core/button' ]; + return ['core/button']; } } @@ -55,12 +53,12 @@ function getModalTriggerAllowedBlocks() { addFilter( 'blocks.registerBlockType', 'blockparty-modal/add-linked-modal-attribute', - ( settings, blockName ) => { + (settings, blockName) => { const allowedBlocks = getModalTriggerAllowedBlocks(); - if ( ! allowedBlocks.includes( blockName ) ) { + if (!allowedBlocks.includes(blockName)) { return settings; } - return addLinkedModalAttribute( settings ); + return addLinkedModalAttribute(settings); } ); @@ -68,74 +66,74 @@ addFilter( // filter — re-register only allowed blocks so linkedModalId is persisted on save. const allowedBlocks = getModalTriggerAllowedBlocks(); const blockTypes = getBlockTypes(); -blockTypes.forEach( ( blockType ) => { +blockTypes.forEach((blockType) => { if ( - allowedBlocks.includes( blockType.name ) && - ! blockType.attributes?.[ LINKED_MODAL_ATTR ] + allowedBlocks.includes(blockType.name) && + !blockType.attributes?.[LINKED_MODAL_ATTR] ) { registerBlockType( blockType.name, - addLinkedModalAttribute( blockType ) + addLinkedModalAttribute(blockType) ); } -} ); +}); // Add "Attached modal" panel with Combobox only to blocks allowed as modal triggers (see filter blockparty_modal_trigger_allowed_blocks). addFilter( 'editor.BlockEdit', 'blockparty-modal/with-modal-trigger-control', - ( BlockEdit ) => ( props ) => { + (BlockEdit) => (props) => { const { name, attributes, setAttributes } = props; - if ( name === MODAL_BLOCK_NAME ) { - return ; + if (name === MODAL_BLOCK_NAME) { + return ; } - const triggerAllowedBlocks = useSelect( ( storeSelect ) => { - const settings = storeSelect( 'core/block-editor' ).getSettings(); + const triggerAllowedBlocks = useSelect((storeSelect) => { + const settings = storeSelect('core/block-editor').getSettings(); const list = settings?.blockpartyModalTriggerAllowedBlocks; - return Array.isArray( list ) ? list : [ 'core/button' ]; - }, [] ); + return Array.isArray(list) ? list : ['core/button']; + }, []); - if ( ! triggerAllowedBlocks.includes( name ) ) { - return ; + if (!triggerAllowedBlocks.includes(name)) { + return ; } - const modalOptions = useSelect( ( storeSelect ) => { - return getModalOptionsFromEditor( storeSelect ); - }, [] ); + const modalOptions = useSelect((storeSelect) => { + return getModalOptionsFromEditor(storeSelect); + }, []); const options = [ - { value: '', label: __( 'None', 'blockparty-modal' ) }, + { value: '', label: __('None', 'blockparty-modal') }, ...modalOptions, ]; - const value = attributes[ LINKED_MODAL_ATTR ] || ''; + const value = attributes[LINKED_MODAL_ATTR] || ''; return ( <> - + - setAttributes( { - [ LINKED_MODAL_ATTR ]: newValue || '', - } ) + )} + value={value} + options={options} + onChange={(newValue) => + setAttributes({ + [LINKED_MODAL_ATTR]: newValue || '', + }) } - placeholder={ __( + placeholder={__( 'Select a modal…', 'blockparty-modal' - ) } + )} /> diff --git a/src/blockparty-modal/save.js b/src/blockparty-modal/save.js index 326fc1f..aba72eb 100644 --- a/src/blockparty-modal/save.js +++ b/src/blockparty-modal/save.js @@ -68,11 +68,7 @@ export default function save( { attributes } ) { type="button" className="wp-block-blockparty-modal__close-button" > - + { __( 'Close this dialog window', 'blockparty-modal' ) } diff --git a/src/blockparty-modal/style.scss b/src/blockparty-modal/style.scss index 2894156..5385ef2 100644 --- a/src/blockparty-modal/style.scss +++ b/src/blockparty-modal/style.scss @@ -54,6 +54,20 @@ padding: 0; border: none; cursor: pointer; + + /* Visually hidden label when icon-only (same role as Core `.screen-reader-text`). */ + .sr-only { + border: 0; + clip: rect(1px, 1px, 1px, 1px); + clip-path: inset(50%); + height: 1px; + margin: -1px; + overflow: hidden; + padding: 0; + position: absolute; + width: 1px; + word-wrap: normal !important; + } } } From bfd33cbed63f6648299eb258cb9bacc274b65826 Mon Sep 17 00:00:00 2001 From: mricoul Date: Thu, 26 Mar 2026 15:51:37 +0100 Subject: [PATCH 3/6] chore(blueprint): update plugin reference to branch Updates the blockparty-modal resource reference from the 1.0.5 tag to the chore/blueprint branch to incorporate recent changes. --- blueprint.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blueprint.json b/blueprint.json index 0b67c06..4b847b5 100644 --- a/blueprint.json +++ b/blueprint.json @@ -16,8 +16,8 @@ "pluginData": { "resource": "git:directory", "url": "https://github.com/BeAPI/blockparty-modal", - "ref": "1.0.5", - "refType": "tag" + "ref": "chore/blueprint", + "refType": "branch" }, "options": { "activate": true, From 564e4bcb2049c7fd234230655b988e150e5edd75 Mon Sep 17 00:00:00 2001 From: mricoul Date: Thu, 26 Mar 2026 15:52:29 +0100 Subject: [PATCH 4/6] chore(blueprint): fix wp-load.php path in PHP script Adds a leading slash to the wp-load.php path to ensure the script correctly bootstraps WordPress within the Playground environment. --- blueprint.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blueprint.json b/blueprint.json index 4b847b5..ea06c89 100644 --- a/blueprint.json +++ b/blueprint.json @@ -26,7 +26,7 @@ }, { "step": "runPHP", - "code": " 'Blockparty Modal',\n\t'post_name' => 'blockparty-modal-demo',\n\t'post_content' => $page_content,\n\t'post_status' => 'publish',\n\t'post_type' => 'page',\n) );\necho 'Page created with ID: ' . $page_id;\n?>" + "code": " 'Blockparty Modal',\n\t'post_name' => 'blockparty-modal-demo',\n\t'post_content' => $page_content,\n\t'post_status' => 'publish',\n\t'post_type' => 'page',\n) );\necho 'Page created with ID: ' . $page_id;\n?>" } ] } From 61202478bd690d5d7db6e625482bec262b8c3e0e Mon Sep 17 00:00:00 2001 From: mricoul Date: Thu, 26 Mar 2026 15:54:48 +0100 Subject: [PATCH 5/6] Revert "chore(blueprint): update plugin reference to branch" This reverts commit bfd33cbed63f6648299eb258cb9bacc274b65826. --- blueprint.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blueprint.json b/blueprint.json index ea06c89..c7f29a3 100644 --- a/blueprint.json +++ b/blueprint.json @@ -16,8 +16,8 @@ "pluginData": { "resource": "git:directory", "url": "https://github.com/BeAPI/blockparty-modal", - "ref": "chore/blueprint", - "refType": "branch" + "ref": "1.0.5", + "refType": "tag" }, "options": { "activate": true, From 844725e631c72ffbc6705a219e2fd64d42f1cbc4 Mon Sep 17 00:00:00 2001 From: mricoul Date: Thu, 26 Mar 2026 15:56:23 +0100 Subject: [PATCH 6/6] chore: releases version 1.0.6 --- .plugin-data | 2 +- README.md | 3 +++ blockparty-modal.php | 4 ++-- blueprint.json | 2 +- package.json | 2 +- readme.txt | 3 +++ src/blockparty-modal/block.json | 2 +- 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.plugin-data b/.plugin-data index 467792b..db3c7e7 100644 --- a/.plugin-data +++ b/.plugin-data @@ -1,4 +1,4 @@ { - "version": "1.0.5", + "version": "1.0.6", "slug": "blockparty-modal" } diff --git a/README.md b/README.md index 3a5134c..52a29db 100644 --- a/README.md +++ b/README.md @@ -272,6 +272,9 @@ This plugin is distributed under the GPL-2.0-or-later license. See the [LICENSE] See [readme.txt](readme.txt) for the full version history. Recent highlights: +- **1.0.6** + - Fix `blueprint.json` config. + - **1.0.5** - Add `blueprint.json` to test the plugin on WordPress Playground. - Add `screen-reader-text` class to close button element when display icon only is selected. diff --git a/blockparty-modal.php b/blockparty-modal.php index f6a0b06..cda091a 100644 --- a/blockparty-modal.php +++ b/blockparty-modal.php @@ -2,7 +2,7 @@ /** * Plugin Name: Blockparty Modal * Description: Modal block for WordPress editor. - * Version: 1.0.5 + * Version: 1.0.6 * Requires at least: 6.8 * Requires PHP: 8.1 * Author: Be API Technical Team @@ -19,7 +19,7 @@ exit; // Exit if accessed directly. } -define( 'BLOCKPARTY_MODAL_VERSION', '1.0.5' ); +define( 'BLOCKPARTY_MODAL_VERSION', '1.0.6' ); define( 'BLOCKPARTY_MODAL_URL', plugin_dir_url( __FILE__ ) ); define( 'BLOCKPARTY_MODAL_DIR', plugin_dir_path( __FILE__ ) ); diff --git a/blueprint.json b/blueprint.json index 1ae7783..1ec22f9 100644 --- a/blueprint.json +++ b/blueprint.json @@ -16,7 +16,7 @@ "pluginData": { "resource": "git:directory", "url": "https://github.com/BeAPI/blockparty-modal", - "ref": "1.0.5", + "ref": "1.0.6", "refType": "tag" }, "options": { diff --git a/package.json b/package.json index fbb2ec2..bedef6a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockparty-modal", - "version": "1.0.5", + "version": "1.0.6", "description": "Add a modal block to the WordPress editor.", "author": "Be API", "license": "GPL-2.0-or-later", diff --git a/readme.txt b/readme.txt index 20cf8bf..666475f 100644 --- a/readme.txt +++ b/readme.txt @@ -45,6 +45,9 @@ directory take precedence. For example, `/assets/screenshot-1.png` would win ove == Changelog == += 1.0.6 = +* Fix `blueprint.json` config. + = 1.0.5 = * Add `blueprint.json` to test the plugin on WordPress Playground. * Add `screen-reader-text` class to close button element when display icon only is selected. diff --git a/src/blockparty-modal/block.json b/src/blockparty-modal/block.json index 9b0b3a8..e734b0d 100644 --- a/src/blockparty-modal/block.json +++ b/src/blockparty-modal/block.json @@ -2,7 +2,7 @@ "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "blockparty/modal", - "version": "1.0.5", + "version": "1.0.6", "title": "Modal", "category": "widgets", "description": "Insert a modal dialog that opens on trigger. Configure content and behaviour in the editor; the modal is displayed on the frontend when activated.",