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 Submenu Block: Add dropdown menu props to ToolsPanel component #68015

Merged
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
3 changes: 3 additions & 0 deletions packages/block-library/src/navigation-submenu/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
getColors,
getNavigationChildBlockProps,
} from '../navigation/edit/utils';
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';

const ALLOWED_BLOCKS = [
'core/navigation-link',
Expand Down Expand Up @@ -153,6 +154,7 @@ export default function NavigationSubmenuEdit( {
const isDraggingWithin = useIsDraggingWithin( listItemRef );
const itemLabelPlaceholder = __( 'Add text…' );
const ref = useRef();
const dropdownMenuProps = useToolsPanelDropdownMenuProps();

const {
parentCount,
Expand Down Expand Up @@ -394,6 +396,7 @@ export default function NavigationSubmenuEdit( {
rel: '',
} );
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it might be worth reconsidering what resetting some of these attributes means.

In a lot of cases, the block will have a post id (also kind and type), meaning it's linked to a particular post, and I think reset could set the value back to that post's title. Resetting to an empty string is quite destructive in that situation.

It'll take a bit of work as there's no code in the block at the moment to make that happen so it's something that can be handled in a separate PR/issue.

I think @getdave might be looking at some related issues at the moment.

} }
dropdownMenuProps={ dropdownMenuProps }
>
<ToolsPanelItem
label={ __( 'Text' ) }
Expand Down
Loading