Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit post: Do not consider sidebars mutually exclusive #61468

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 1 addition & 15 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { ScrollLock } from '@wordpress/components';
import { useViewportMatch } from '@wordpress/compose';
import { PluginArea } from '@wordpress/plugins';
import { __, _x, sprintf } from '@wordpress/i18n';
import { useState, useEffect, useCallback, useMemo } from '@wordpress/element';
import { useState, useCallback, useMemo } from '@wordpress/element';
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
import { store as noticesStore } from '@wordpress/notices';
import { store as preferencesStore } from '@wordpress/preferences';
Expand Down Expand Up @@ -135,13 +135,11 @@ function Layout( { initialPost } ) {
useCommonCommands();

const isMobileViewport = useViewportMatch( 'medium', '<' );
const isHugeViewport = useViewportMatch( 'huge', '>=' );
const isWideViewport = useViewportMatch( 'large' );
const isLargeViewport = useViewportMatch( 'medium' );

const { closeGeneralSidebar } = useDispatch( editPostStore );
const { createErrorNotice } = useDispatch( noticesStore );
const { setIsInserterOpened } = useDispatch( editorStore );
const {
mode,
isFullscreenActive,
Expand Down Expand Up @@ -212,18 +210,6 @@ function Layout( { initialPost } ) {

const styles = useEditorStyles();

// Inserter and Sidebars are mutually exclusive
useEffect( () => {
if ( sidebarIsOpened && ! isHugeViewport ) {
setIsInserterOpened( false );
}
}, [ isHugeViewport, setIsInserterOpened, sidebarIsOpened ] );
useEffect( () => {
if ( isInserterOpened && ! isHugeViewport ) {
closeGeneralSidebar();
}
}, [ closeGeneralSidebar, isInserterOpened, isHugeViewport ] );

// Local state for save panel.
// Note 'truthy' callback implies an open panel.
const [ entitiesSavedStatesCallback, setEntitiesSavedStatesCallback ] =
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/specs/editor/blocks/image.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@ test.describe( 'Image', () => {
page,
editor,
} ) => {
// This is a temp workaround for dragging and dropping images from the inserter.
// This should be removed when we have the zoom out view for media categories.
await page.setViewportSize( { width: 1400, height: 800 } );
await editor.insertBlock( { name: 'core/image' } );
const imageBlock = editor.canvas.getByRole( 'document', {
name: 'Block: Image',
Expand Down
2 changes: 1 addition & 1 deletion test/performance/specs/post-editor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ test.describe( 'Post Editor Performance', () => {

const startTime = performance.now();

await page.getByText( 'Test' ).click();
await page.getByRole( 'tab', { name: 'Test' } ).click();
Copy link
Member

Choose a reason for hiding this comment

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

@ntsekouras I'm curious why you changed this? It's causing the performance tests to fail for 6.5, where this had the role of a button.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think there were two elements with the test and we wanted that tab one.


await Promise.all(
testPatterns.map( async ( pattern ) => {
Expand Down
Loading