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

Navigation Sidebar: Change the logic about which navigation gets selected for the sidebar #48689

Merged
merged 8 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 2 additions & 2 deletions packages/block-editor/src/components/inserter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const defaultRenderToggle = ( {
label = _x( 'Add block', 'Generic label for block inserter button' );
}

const { onClick, ...rest } = toggleProps;
const { as: Wrapper = Button, onClick, ...rest } = toggleProps;

// Handle both onClick functions from the toggle and the parent component.
function handleClick( event ) {
Expand All @@ -57,7 +57,7 @@ const defaultRenderToggle = ( {
}

return (
<Button
<Wrapper
icon={ plus }
label={ label }
tooltipPosition="bottom"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function ListViewBranch( props ) {
isExpanded,
parentId,
shouldShowInnerBlocks = true,
showAppender: showAppenderProp = true,
} = props;

const isContentLocked = useSelect(
Expand All @@ -117,7 +118,7 @@ function ListViewBranch( props ) {
}

// Only show the appender at the first level.
const showAppender = level === 1;
const showAppender = showAppenderProp && level === 1;

const filteredBlocks = blocks.filter( Boolean );
const blockCount = filteredBlocks.length;
Expand Down Expand Up @@ -205,6 +206,7 @@ function ListViewBranch( props ) {
isBranchSelected={ isSelectedBranch }
selectedClientIds={ selectedClientIds }
isExpanded={ isExpanded }
showAppender={ showAppenderProp }
/>
) }
</AsyncModeProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36;
* @param {Object} props.LeafMoreMenu Optional more menu substitution.
* @param {string} props.description Optional accessible description for the tree grid component.
* @param {string} props.onSelect Optional callback to be invoked when a block is selected.
* @param {string} props.showAppender Flag to show or hide the block appender.
* @param {Object} ref Forwarded ref
*/
function OffCanvasEditor(
Expand All @@ -70,6 +71,7 @@ function OffCanvasEditor(
blocks,
showBlockMovers = false,
isExpanded = false,
showAppender = true,
LeafMoreMenu,
description = __( 'Block navigation structure' ),
onSelect,
Expand Down Expand Up @@ -240,6 +242,7 @@ function OffCanvasEditor(
selectedClientIds={ selectedClientIds }
isExpanded={ isExpanded }
shouldShowInnerBlocks={ shouldShowInnerBlocks }
showAppender={ showAppender }
/>
<TreeGridRow
level={ 1 }
Expand Down
191 changes: 0 additions & 191 deletions packages/edit-site/src/components/navigation-inspector/index.js

This file was deleted.

46 changes: 0 additions & 46 deletions packages/edit-site/src/components/navigation-inspector/style.scss

This file was deleted.

3 changes: 2 additions & 1 deletion packages/edit-site/src/components/sidebar-button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
&:hover,
&:focus-visible,
&:focus,
&:not([aria-disabled="true"]):active {
&:not([aria-disabled="true"]):active,
&[aria-expanded="true"] {
color: $white;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,6 @@
}
}

.edit-site-sidebar-navigation-screen__content .edit-site-navigation-inspector .components-button {
color: $gray-600;
&:hover,
&:focus,
&[aria-current] {
color: $white;
}
}

.edit-site-sidebar-navigation-screen__content .edit-site-navigation-inspector .offcanvas-editor-list-view-leaf {
&:hover,
&:focus,
&[aria-current] {
background: $gray-800;
}
.block-editor-list-view-block__menu {
margin-left: -$grid-unit-10;
}
}

.edit-site-sidebar-navigation-screen__content .block-editor-list-view-block-select-button {
cursor: grab;
width: calc(100% - #{ $border-width-focus });
Expand Down
Loading