From 43c86a7ff6984d690bca2d009c7d25a0ec97aef0 Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Wed, 14 Oct 2026 20:06:03 +0530 Subject: [PATCH 1/2] Blocks: Accept a feature path array in getBlockSupport and hasBlockSupport --- packages/blocks/README.md | 4 ++-- packages/blocks/src/api/registration.ts | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/blocks/README.md b/packages/blocks/README.md index 72f521eaacb6e4..05bd1cb6d924aa 100644 --- a/packages/blocks/README.md +++ b/packages/blocks/README.md @@ -205,7 +205,7 @@ Returns the block support value for a feature, if defined. _Parameters_ - _nameOrType_ `string | BlockType`: Block name or type object -- _feature_ `string`: Feature to retrieve +- _feature_ `string | string[]`: Feature to retrieve, as a dot-separated path or an array of path segments - _defaultSupports_ `unknown`: Default value to return if not explicitly defined _Returns_ @@ -340,7 +340,7 @@ Returns true if the block defines support for a feature, or false otherwise. _Parameters_ - _nameOrType_ `string | BlockType`: Block name or type object. -- _feature_ `string`: Feature to test. +- _feature_ `string | string[]`: Feature to test, as a dot-separated path or an array of path segments. - _defaultSupports_ `boolean`: Whether feature is supported by default if not explicitly defined. _Returns_ diff --git a/packages/blocks/src/api/registration.ts b/packages/blocks/src/api/registration.ts index 155a889be35f84..e0c541a8684d31 100644 --- a/packages/blocks/src/api/registration.ts +++ b/packages/blocks/src/api/registration.ts @@ -449,7 +449,8 @@ export function getBlockTypes(): BlockType[] { * Returns the block support value for a feature, if defined. * * @param nameOrType Block name or type object - * @param feature Feature to retrieve + * @param feature Feature to retrieve, as a dot-separated path or an + * array of path segments * @param defaultSupports Default value to return if not * explicitly defined * @@ -457,7 +458,7 @@ export function getBlockTypes(): BlockType[] { */ export function getBlockSupport( nameOrType: string | BlockType, - feature: string, + feature: string | string[], defaultSupports?: unknown ): unknown { return select( blocksStore ).getBlockSupport( @@ -471,7 +472,8 @@ export function getBlockSupport( * Returns true if the block defines support for a feature, or false otherwise. * * @param nameOrType Block name or type object. - * @param feature Feature to test. + * @param feature Feature to test, as a dot-separated path or an array + * of path segments. * @param defaultSupports Whether feature is supported by * default if not explicitly defined. * @@ -479,7 +481,7 @@ export function getBlockSupport( */ export function hasBlockSupport( nameOrType: string | BlockType, - feature: string, + feature: string | string[], defaultSupports?: boolean ): boolean { return select( blocksStore ).hasBlockSupport( From ef1f8e6926970a6cd07e39d0f63560bb3cc0254f Mon Sep 17 00:00:00 2001 From: Manzoor Wani Date: Wed, 14 Oct 2026 20:08:44 +0530 Subject: [PATCH 2/2] Blocks: Add the CHANGELOG entry for the feature path array --- packages/blocks/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/blocks/CHANGELOG.md b/packages/blocks/CHANGELOG.md index 764548c77dbe18..506b8ba1a0ee82 100644 --- a/packages/blocks/CHANGELOG.md +++ b/packages/blocks/CHANGELOG.md @@ -7,6 +7,10 @@ - Raise the minimum required Node.js version to `>=22.13.0`, for stable `require(esm)` support ([#84313](https://github.com/WordPress/gutenberg/pull/84313)). - Stop normalizing deprecated responsive style state aliases while parsing blocks; saved style attributes must use canonical state keys ([#84531](https://github.com/WordPress/gutenberg/pull/84531)). +### Bug Fixes + +- `getBlockSupport` and `hasBlockSupport`: Accept the feature as an array of path segments in the types, as the store selectors and runtime already do ([#84708](https://github.com/WordPress/gutenberg/pull/84708)). + ## 16.2.0 (2026-10-07) ### Bug Fixes