Skip to content

Commit

Permalink
Editor: Limit spotlight mode to the editor. (#58817)
Browse files Browse the repository at this point in the history
* Limit spotlight mode to the editor.

* Revert "Limit spotlight mode to the editor."

This reverts commit b8d4754.

* Disable "Spotlight mode" for block previews.

* Revert non-required changes.
  • Loading branch information
juanfra committed Feb 14, 2024
1 parent 7acb269 commit ba496e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/block-editor/src/components/block-preview/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ export function BlockPreview( {
[]
);
const settings = useMemo(
() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),
() => ( {
...originalSettings,
focusMode: false, // Disable "Spotlight mode".
__unstableIsPreviewMode: true,
} ),
[ originalSettings ]
);
const renderedBlocks = useMemo(
Expand Down Expand Up @@ -117,6 +121,7 @@ export function useBlockPreview( { blocks, props = {}, layout } ) {
() => ( {
...originalSettings,
styles: undefined, // Clear styles included by the parent settings, as they are already output by the parent's EditorStyles.
focusMode: false, // Disable "Spotlight mode".
__unstableIsPreviewMode: true,
} ),
[ originalSettings ]
Expand Down
6 changes: 5 additions & 1 deletion packages/edit-site/src/components/style-book/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,11 @@ const Example = ( { id, title, blocks, isSelected, onClick } ) => {
[]
);
const settings = useMemo(
() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),
() => ( {
...originalSettings,
focusMode: false, // Disable "Spotlight mode".
__unstableIsPreviewMode: true,
} ),
[ originalSettings ]
);

Expand Down

1 comment on commit ba496e6

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in ba496e6.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7903656386
📝 Reported issues:

Please sign in to comment.