From 8a00f6a9632653b065638ca63df1060f0c0358d1 Mon Sep 17 00:00:00 2001 From: Sarah Norris Date: Tue, 18 Oct 2022 00:59:19 +0100 Subject: [PATCH 01/11] Fallback to font size slug if name is undefined (#45041) --- packages/components/src/font-size-picker/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/font-size-picker/index.js b/packages/components/src/font-size-picker/index.js index 1fb266bba02b2b..47668eb2dca161 100644 --- a/packages/components/src/font-size-picker/index.js +++ b/packages/components/src/font-size-picker/index.js @@ -116,7 +116,7 @@ function FontSizePicker( } // Calculate the `hint` for toggle group control. - let hint = selectedOption.name; + let hint = selectedOption?.name || selectedOption.slug; if ( ! fontSizesContainComplexValues && typeof selectedOption.size === 'string' From 9ad568e78a8ca73f8a4ad05a80f9fbea48ef92d8 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Mon, 17 Oct 2022 21:23:38 +0100 Subject: [PATCH 02/11] Add: Missing output escaping on some blocks. (#45045) --- packages/block-library/src/navigation/index.php | 2 +- packages/block-library/src/rss/index.php | 6 +++--- packages/block-library/src/search/index.php | 10 +++++----- packages/widgets/src/blocks/legacy-widget/index.php | 2 +- packages/widgets/src/blocks/widget-group/index.php | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index 33e1ebdbab56d4..c3f6317eb2955d 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -646,7 +646,7 @@ function render_block_core_navigation( $attributes, $content, $block ) { $toggle_aria_label_close, esc_attr( implode( ' ', $responsive_container_classes ) ), esc_attr( implode( ' ', $open_button_classes ) ), - safecss_filter_attr( $colors['overlay_inline_styles'] ), + esc_attr( safecss_filter_attr( $colors['overlay_inline_styles'] ) ), __( 'Menu' ), $toggle_button_content, $toggle_close_button_content diff --git a/packages/block-library/src/rss/index.php b/packages/block-library/src/rss/index.php index 0edbc90490c314..e32155195af1db 100644 --- a/packages/block-library/src/rss/index.php +++ b/packages/block-library/src/rss/index.php @@ -20,7 +20,7 @@ function render_block_core_rss( $attributes ) { $rss = fetch_feed( $attributes['feedURL'] ); if ( is_wp_error( $rss ) ) { - return '
' . __( 'RSS Error:' ) . ' ' . $rss->get_error_message() . '
'; + return '
' . __( 'RSS Error:' ) . ' ' . esc_html( $rss->get_error_message() ) . '
'; } if ( ! $rss->get_item_quantity() ) { @@ -48,8 +48,8 @@ function render_block_core_rss( $attributes ) { if ( $date ) { $date = sprintf( ' ', - date_i18n( get_option( 'c' ), $date ), - date_i18n( get_option( 'date_format' ), $date ) + esc_attr( date_i18n( get_option( 'c' ), $date ) ), + esc_attr( date_i18n( get_option( 'date_format' ), $date ) ) ); } } diff --git a/packages/block-library/src/search/index.php b/packages/block-library/src/search/index.php index 61b2cf2b06b511..26b6a7585ccc7f 100644 --- a/packages/block-library/src/search/index.php +++ b/packages/block-library/src/search/index.php @@ -367,12 +367,12 @@ function styles_for_block_core_search( $attributes ) { // Add color styles. $has_text_color = ! empty( $attributes['style']['color']['text'] ); if ( $has_text_color ) { - $button_styles[] = sprintf( 'color: %s;', esc_attr( $attributes['style']['color']['text'] ) ); + $button_styles[] = sprintf( 'color: %s;', $attributes['style']['color']['text'] ); } $has_background_color = ! empty( $attributes['style']['color']['background'] ); if ( $has_background_color ) { - $button_styles[] = sprintf( 'background-color: %s;', esc_attr( $attributes['style']['color']['background'] ) ); + $button_styles[] = sprintf( 'background-color: %s;', $attributes['style']['color']['background'] ); } $has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] ); @@ -399,9 +399,9 @@ function styles_for_block_core_search( $attributes ) { } return array( - 'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $input_styles ) ) ) : '', - 'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $button_styles ) ) ) : '', - 'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) : '', + 'input' => ! empty( $input_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $input_styles ) ) ) ) : '', + 'button' => ! empty( $button_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $button_styles ) ) ) ) : '', + 'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $wrapper_styles ) ) ) ) : '', 'label' => ! empty( $label_styles ) ? sprintf( ' style="%s"', esc_attr( safecss_filter_attr( implode( ' ', $label_styles ) ) ) ) : '', ); } diff --git a/packages/widgets/src/blocks/legacy-widget/index.php b/packages/widgets/src/blocks/legacy-widget/index.php index c3aa55fdfe241d..94cfb9ba71ebfd 100644 --- a/packages/widgets/src/blocks/legacy-widget/index.php +++ b/packages/widgets/src/blocks/legacy-widget/index.php @@ -34,7 +34,7 @@ function render_block_core_legacy_widget( $attributes ) { if ( isset( $attributes['instance']['encoded'], $attributes['instance']['hash'] ) ) { $serialized_instance = base64_decode( $attributes['instance']['encoded'] ); - if ( wp_hash( $serialized_instance ) !== $attributes['instance']['hash'] ) { + if ( ! hash_equals( wp_hash( $serialized_instance ), (string) $attributes['instance']['hash'] ) ) { return ''; } $instance = unserialize( $serialized_instance ); diff --git a/packages/widgets/src/blocks/widget-group/index.php b/packages/widgets/src/blocks/widget-group/index.php index 6cf6442346a306..8c8584b296d57e 100644 --- a/packages/widgets/src/blocks/widget-group/index.php +++ b/packages/widgets/src/blocks/widget-group/index.php @@ -28,7 +28,7 @@ function render_block_core_widget_group( $attributes, $content, $block ) { $html = ''; if ( ! empty( $attributes['title'] ) ) { - $html .= $before_title . $attributes['title'] . $after_title; + $html .= $before_title . esc_html( $attributes['title'] ) . $after_title; } $html .= '
'; From 56c871a01d04aad93bc9c327c9c3c913204ebab8 Mon Sep 17 00:00:00 2001 From: Zenaul Islam Date: Sun, 16 Oct 2022 21:04:08 +0600 Subject: [PATCH 03/11] Escape comment author URL --- packages/block-library/src/avatar/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/avatar/index.php b/packages/block-library/src/avatar/index.php index 9e20d81b648eda..f6e3f6a7eeaf23 100644 --- a/packages/block-library/src/avatar/index.php +++ b/packages/block-library/src/avatar/index.php @@ -127,7 +127,7 @@ function render_block_core_avatar( $attributes, $content, $block ) { $label = 'aria-label="' . sprintf( esc_attr__( '(%s website link, opens in a new tab)' ), $comment->comment_author ) . '"'; } // translators: %1$s: Comment Author website link. %2$s: Link target. %3$s Aria label. %4$s Avatar image. - $avatar_block = sprintf( '%4$s', $comment->comment_author_url, esc_attr( $attributes['linkTarget'] ), $label, $avatar_block ); + $avatar_block = sprintf( '%4$s', esc_url( $comment->comment_author_url ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block ); } return sprintf( '
%2s
', $wrapper_attributes, $avatar_block ); } From 346ff74d91a1368f197e63e50df5f02029907e0f Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Thu, 13 Oct 2022 14:23:32 +1000 Subject: [PATCH 04/11] Spacing Sizes Control: Improve layout spacing (#44858) --- .../spacing-input-control.js | 2 + .../spacing-sizes-control/style.scss | 45 +++++++++++-------- 2 files changed, 28 insertions(+), 19 deletions(-) diff --git a/packages/block-editor/src/components/spacing-sizes-control/spacing-input-control.js b/packages/block-editor/src/components/spacing-sizes-control/spacing-input-control.js index cf9a663fe1fa1e..4a08bb9b3348a7 100644 --- a/packages/block-editor/src/components/spacing-sizes-control/spacing-input-control.js +++ b/packages/block-editor/src/components/spacing-sizes-control/spacing-input-control.js @@ -221,6 +221,7 @@ export default function SpacingInputControl( { hideLabelFromVision={ true } className="components-spacing-sizes-control__custom-value-input" style={ { gridColumn: '1' } } + size={ '__unstable-large' } /> ) } diff --git a/packages/block-editor/src/components/spacing-sizes-control/style.scss b/packages/block-editor/src/components/spacing-sizes-control/style.scss index 27b83a9ba5ca81..02731920c5e6ff 100644 --- a/packages/block-editor/src/components/spacing-sizes-control/style.scss +++ b/packages/block-editor/src/components/spacing-sizes-control/style.scss @@ -2,7 +2,7 @@ display: grid; grid-template-columns: auto 1fr auto; align-items: center; - grid-template-rows: 25px auto; + grid-template-rows: 16px auto; } .component-spacing-sizes-control { @@ -27,7 +27,7 @@ grid-column: 1 / 1; justify-content: left; height: $grid-unit-20; - margin-top: $grid-unit-15; + margin-top: $grid-unit-20; } .components-spacing-sizes-control__side-label { @@ -37,8 +37,9 @@ } &.is-unlinked { - .components-range-control.components-spacing-sizes-control__range-control { - margin-top: $grid-unit-15; + .components-range-control.components-spacing-sizes-control__range-control, + .components-spacing-sizes-control__custom-value-input { + margin-top: $grid-unit-10; } } @@ -60,12 +61,7 @@ grid-column: 2 / 2; grid-row: 1 / 1; justify-self: end; - padding: 0; - &.is-small.has-icon { - padding: 0; - min-width: $icon-size; - height: $grid-unit-20; - } + margin-top: -4px; } .component-spacing-sizes-control__linked-button ~ .components-spacing-sizes-control__custom-toggle-all { @@ -75,33 +71,43 @@ .components-spacing-sizes-control__custom-toggle-single { grid-column: 3 / 3; justify-self: end; - &.is-small.has-icon { - padding: 0; - min-width: $icon-size; - height: $grid-unit-20; - margin-top: $grid-unit-15; - } + margin-top: $grid-unit-15; } .component-spacing-sizes-control__linked-button { grid-column: 3 / 3; grid-row: 1 / 1; justify-self: end; + line-height: 0; + margin-top: -4px; } .components-spacing-sizes-control__custom-value-range { grid-column: span 2; - margin-left: $grid-unit-10; - height: 30px; + margin-left: $grid-unit-20; + margin-top: 8px; } .components-spacing-sizes-control__custom-value-input { width: 124px; + margin-top: 8px; + } + + .components-range-control { + height: 40px; + /* Vertically center the RangeControl until it has true 40px height. */ + display: flex; + align-items: center; + + > .components-base-control__field { + /* Fixes RangeControl contents when the outer wrapper is flex */ + flex: 1; + } } .components-spacing-sizes-control__range-control { grid-column: span 3; - height: 40px; + margin-top: 8px; } .components-range-control__mark { @@ -125,5 +131,6 @@ .components-spacing-sizes-control__custom-select-control { grid-column: span 3; + margin-top: $grid-unit-10; } } From 6ef0ed8735cbb177f23e035ed3878b0b9ee42c79 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Wed, 12 Oct 2022 10:31:59 +0100 Subject: [PATCH 05/11] Fix: Inspector is usable on the top level block even if it is content locked (#44878) --- .../block-editor/src/components/block-inspector/index.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/src/components/block-inspector/index.js b/packages/block-editor/src/components/block-inspector/index.js index e9a0e0b85bdc7b..becb96ca60b1cb 100644 --- a/packages/block-editor/src/components/block-inspector/index.js +++ b/packages/block-editor/src/components/block-inspector/index.js @@ -144,6 +144,7 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => { getSelectedBlockCount, getBlockName, __unstableGetContentLockingParent, + getTemplateLock, } = select( blockEditorStore ); const _selectedBlockClientId = getSelectedBlockClientId(); @@ -157,9 +158,11 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => { selectedBlockClientId: _selectedBlockClientId, selectedBlockName: _selectedBlockName, blockType: _blockType, - topLevelLockedBlock: __unstableGetContentLockingParent( - _selectedBlockClientId - ), + topLevelLockedBlock: + __unstableGetContentLockingParent( _selectedBlockClientId ) || + ( getTemplateLock( _selectedBlockClientId ) === 'contentOnly' + ? _selectedBlockClientId + : undefined ), }; }, [] ); From a5efd9dd6d555e2a0331900f7768d250eeb1e8f3 Mon Sep 17 00:00:00 2001 From: benridane <15902112+benridane@users.noreply.github.com> Date: Tue, 11 Oct 2022 22:29:50 +0900 Subject: [PATCH 06/11] Fix list outdents on Enter in quote block (#44809) --- .../list-item/hooks/use-outdent-list-item.js | 8 ++++-- test/e2e/specs/editor/blocks/list.spec.js | 26 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/list-item/hooks/use-outdent-list-item.js b/packages/block-library/src/list-item/hooks/use-outdent-list-item.js index 93472f49dbba8d..d4c034b06e8134 100644 --- a/packages/block-library/src/list-item/hooks/use-outdent-list-item.js +++ b/packages/block-library/src/list-item/hooks/use-outdent-list-item.js @@ -20,12 +20,16 @@ export default function useOutdentListItem( clientId ) { const registry = useRegistry(); const { canOutdent } = useSelect( ( innerSelect ) => { - const { getBlockRootClientId } = innerSelect( blockEditorStore ); + const { getBlockRootClientId, getBlockName } = + innerSelect( blockEditorStore ); const grandParentId = getBlockRootClientId( getBlockRootClientId( clientId ) ); + const grandParentName = getBlockName( grandParentId ); + const isListItem = grandParentName === listItemName; + return { - canOutdent: !! grandParentId, + canOutdent: isListItem, }; }, [ clientId ] diff --git a/test/e2e/specs/editor/blocks/list.spec.js b/test/e2e/specs/editor/blocks/list.spec.js index 76c334257387d3..c0133cc73629ac 100644 --- a/test/e2e/specs/editor/blocks/list.spec.js +++ b/test/e2e/specs/editor/blocks/list.spec.js @@ -602,6 +602,32 @@ test.describe( 'List', () => { ); } ); + test( 'should create paragraph on Enter in quote block', async ( { + editor, + page, + } ) => { + await editor.insertBlock( { name: 'core/quote' } ); + await page.keyboard.type( '/list' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.type( 'aaa' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.press( 'Enter' ); + + await expect.poll( editor.getEditedPostContent ).toBe( + ` +
+
    +
  • aaa
  • +
+ + + +

+
+` + ); + } ); + test( 'should indent and outdent level 1', async ( { editor, page } ) => { await editor.insertBlock( { name: 'core/list' } ); await page.keyboard.type( 'a' ); From 1736a08efdcc77a2fa9d2006df6da060789a64d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= <4710635+ellatrix@users.noreply.github.com> Date: Tue, 11 Oct 2022 13:00:52 +0200 Subject: [PATCH 07/11] List v2: fix selection when creating paragraph from empty list item (#44864) --- .../inner-blocks/use-inner-block-template-sync.js | 5 +++-- ...st-can-be-exited-to-selected-paragraph-1-chromium.txt | 9 +++++++++ test/e2e/specs/editor/blocks/list.spec.js | 9 +++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 test/e2e/specs/editor/blocks/__snapshots__/List-can-be-exited-to-selected-paragraph-1-chromium.txt diff --git a/packages/block-editor/src/components/inner-blocks/use-inner-block-template-sync.js b/packages/block-editor/src/components/inner-blocks/use-inner-block-template-sync.js index 5eff89609f6d8c..1b81069c44f3dc 100644 --- a/packages/block-editor/src/components/inner-blocks/use-inner-block-template-sync.js +++ b/packages/block-editor/src/components/inner-blocks/use-inner-block-template-sync.js @@ -40,7 +40,7 @@ export default function useInnerBlockTemplateSync( templateLock, templateInsertUpdatesSelection ) { - const { getSelectedBlocksInitialCaretPosition } = + const { getSelectedBlocksInitialCaretPosition, isBlockSelected } = useSelect( blockEditorStore ); const { replaceInnerBlocks } = useDispatch( blockEditorStore ); const innerBlocks = useSelect( @@ -86,7 +86,8 @@ export default function useInnerBlockTemplateSync( nextBlocks, currentInnerBlocks.length === 0 && templateInsertUpdatesSelection && - nextBlocks.length !== 0, + nextBlocks.length !== 0 && + isBlockSelected( clientId ), // This ensures the "initialPosition" doesn't change when applying the template // If we're supposed to focus the block, we'll focus the first inner block // otherwise, we won't apply any auto-focus. diff --git a/test/e2e/specs/editor/blocks/__snapshots__/List-can-be-exited-to-selected-paragraph-1-chromium.txt b/test/e2e/specs/editor/blocks/__snapshots__/List-can-be-exited-to-selected-paragraph-1-chromium.txt new file mode 100644 index 00000000000000..468d73c8514442 --- /dev/null +++ b/test/e2e/specs/editor/blocks/__snapshots__/List-can-be-exited-to-selected-paragraph-1-chromium.txt @@ -0,0 +1,9 @@ + +
    +
  • +
+ + + +

1

+ \ No newline at end of file diff --git a/test/e2e/specs/editor/blocks/list.spec.js b/test/e2e/specs/editor/blocks/list.spec.js index c0133cc73629ac..ad63edc6fbaf0d 100644 --- a/test/e2e/specs/editor/blocks/list.spec.js +++ b/test/e2e/specs/editor/blocks/list.spec.js @@ -1225,4 +1225,13 @@ test.describe( 'List', () => { ` ); } ); + + test( 'can be exited to selected paragraph', async ( { editor, page } ) => { + await page.click( 'role=button[name="Add default block"i]' ); + await page.keyboard.type( '* ' ); + await page.keyboard.press( 'Enter' ); + await page.keyboard.type( '1' ); + + expect( await editor.getEditedPostContent() ).toMatchSnapshot(); + } ); } ); From 5f1a6356033625fdca7c3c7ab5c1a1411ccbe53b Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Tue, 11 Oct 2022 16:35:12 +0800 Subject: [PATCH 08/11] Fix overflowing patterns (#44853) * Fix overflowing patterns by using overflow:hidden * Revert "Fix overflowing patterns by using overflow:hidden" This reverts commit d47f721aeb37fbeeb2455974bfc3a165fabca874. * Make pattern list items position: relative so that position: absolute visually hidden text is positioned correctly --- .../src/components/block-patterns-list/style.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/block-editor/src/components/block-patterns-list/style.scss b/packages/block-editor/src/components/block-patterns-list/style.scss index 8ae80f63ce1e3e..3b5c2571be0fa8 100644 --- a/packages/block-editor/src/components/block-patterns-list/style.scss +++ b/packages/block-editor/src/components/block-patterns-list/style.scss @@ -2,6 +2,11 @@ cursor: pointer; margin-bottom: $grid-unit-30; + // The list item contains absolutely positioned visually hidden text, + // so make this container relative. This prevents the bug experienced in + // https://github.com/WordPress/gutenberg/issues/44842. + position: relative; + &.is-placeholder { min-height: 100px; } From 74a6d89deb88389889d1cfaca5518eb77deb631b Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Mon, 17 Oct 2022 11:18:34 +0200 Subject: [PATCH 09/11] Navigator: restore focus only once per location (#44972) --- packages/components/CHANGELOG.md | 1 + .../src/navigator/navigator-provider/component.tsx | 2 ++ .../src/navigator/navigator-screen/component.tsx | 10 +++++++++- packages/components/src/navigator/types.ts | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 31ad5b0457d7ef..bf32aadd73ff5a 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -5,6 +5,7 @@ ### Bug Fix - `FontSizePicker`: Ensure that fluid font size presets appear correctly in the UI controls ([#44791](https://github.com/WordPress/gutenberg/pull/44791)) +- `Navigator`: restore focus only once per location ([#44972](https://github.com/WordPress/gutenberg/pull/44972)). - The `LinkedButton` to unlink sides in `BoxControl`, `BorderBoxControl` and `BorderRadiusControl` have changed from a rectangular primary button to an icon-only button, with a sentence case tooltip, and default-size icon for better legibility. The `Button` component has been fixed so when `isSmall` and `icon` props are set, and no text is present, the button shape is square rather than rectangular. - `Popover`: fix limitShift logic by adding iframe offset correctly [#42950](https://github.com/WordPress/gutenberg/pull/42950)). diff --git a/packages/components/src/navigator/navigator-provider/component.tsx b/packages/components/src/navigator/navigator-provider/component.tsx index 634c6f8204b10e..fc769f2f5736ca 100644 --- a/packages/components/src/navigator/navigator-provider/component.tsx +++ b/packages/components/src/navigator/navigator-provider/component.tsx @@ -49,6 +49,7 @@ function NavigatorProvider( ...options, path, isBack: false, + hasRestoredFocus: false, }, ] ); }, @@ -62,6 +63,7 @@ function NavigatorProvider( { ...locationHistory[ locationHistory.length - 2 ], isBack: true, + hasRestoredFocus: false, }, ] ); } diff --git a/packages/components/src/navigator/navigator-screen/component.tsx b/packages/components/src/navigator/navigator-screen/component.tsx index 94b7bfee306e97..092b95b50d97f6 100644 --- a/packages/components/src/navigator/navigator-screen/component.tsx +++ b/packages/components/src/navigator/navigator-screen/component.tsx @@ -79,7 +79,13 @@ function NavigatorScreen( props: Props, forwardedRef: ForwardedRef< any > ) { // - if the current location is not the initial one (to avoid moving focus on page load) // - when the screen becomes visible // - if the wrapper ref has been assigned - if ( isInitialLocation || ! isMatch || ! wrapperRef.current ) { + // - if focus hasn't already been restored for the current location + if ( + isInitialLocation || + ! isMatch || + ! wrapperRef.current || + location.hasRestoredFocus + ) { return; } @@ -103,10 +109,12 @@ function NavigatorScreen( props: Props, forwardedRef: ForwardedRef< any > ) { elementToFocus = firstTabbable ?? wrapperRef.current; } + location.hasRestoredFocus = true; elementToFocus.focus(); }, [ isInitialLocation, isMatch, + location.hasRestoredFocus, location.isBack, previousLocation?.focusTargetSelector, ] ); diff --git a/packages/components/src/navigator/types.ts b/packages/components/src/navigator/types.ts index edc80c356e18e5..217b9408923374 100644 --- a/packages/components/src/navigator/types.ts +++ b/packages/components/src/navigator/types.ts @@ -11,6 +11,7 @@ export type NavigatorLocation = NavigateOptions & { isInitial?: boolean; isBack?: boolean; path?: string; + hasRestoredFocus?: boolean; }; export type NavigatorContext = { From 25d2b4c906bd04ea0520e4c54d015864dda809ef Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 18 Oct 2022 11:52:39 +1100 Subject: [PATCH 10/11] Fix visibility of nested Group block appender (#45050) --- .../src/components/button-block-appender/style.scss | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/button-block-appender/style.scss b/packages/block-editor/src/components/button-block-appender/style.scss index 45358b9a0f0503..b2af07e50a9443 100644 --- a/packages/block-editor/src/components/button-block-appender/style.scss +++ b/packages/block-editor/src/components/button-block-appender/style.scss @@ -36,8 +36,9 @@ .block-list-appender:only-child { .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > &, .is-layout-flow.block-editor-block-list__block:not(.is-selected) > &, - .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > &, - .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .block-editor-block-list__layout > & { + // Legacy groups have an inner container so need to be targeted separately + .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > .wp-block-group__inner-container > &, + .is-layout-flow.block-editor-block-list__block:not(.is-selected) > .wp-block-group__inner-container > & { pointer-events: none; &::after { From 8048ef85dbe26d024303aedfd5d5df340056ebd6 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Wed, 12 Oct 2022 14:36:23 +1100 Subject: [PATCH 11/11] wp-env: Use case insensitive regex when checking WP version string (#44887) WordPress version strings use '-RC1', not '-rc1'. This causes wp-env to look for a tag in wordpress-develop that does not exist, which in turn causes a fatal error. --- packages/env/lib/download-wp-phpunit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/env/lib/download-wp-phpunit.js b/packages/env/lib/download-wp-phpunit.js index 923750d58b1d73..3900fd9495343d 100644 --- a/packages/env/lib/download-wp-phpunit.js +++ b/packages/env/lib/download-wp-phpunit.js @@ -122,7 +122,7 @@ async function downloadTestSuite( // Alpha, Beta, and RC versions are bleeding edge and should pull from trunk. let ref; const fetchRaw = []; - if ( ! wpVersion || wpVersion.match( /-(?:alpha|beta|rc)/ ) ) { + if ( ! wpVersion || wpVersion.match( /-(?:alpha|beta|rc)/i ) ) { ref = 'trunk'; fetchRaw.push( 'fetch', 'origin', ref, '--depth', '1' ); } else {