-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
DropdownMenu: Deprecate 36px default size for toggle button #68329
base: button-deprecate-size
Are you sure you want to change the base?
Conversation
Size Change: +231 B (+0.01%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
Flaky tests detected in 3d56175. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12508929385
|
@@ -67,7 +67,7 @@ exports[`AlignmentUI should match snapshot when controls are hidden 1`] = ` | |||
aria-expanded="false" | |||
aria-haspopup="true" | |||
aria-label="Align text" | |||
class="components-button components-dropdown-menu__toggle has-icon" | |||
class="components-button components-dropdown-menu__toggle is-compact has-icon" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -10,7 +10,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are hidden 1`] = ` | |||
aria-expanded="false" | |||
aria-haspopup="true" | |||
aria-label="Align" | |||
class="components-button components-dropdown-menu__toggle has-icon" | |||
class="components-button components-dropdown-menu__toggle is-compact has-icon" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -18,7 +18,7 @@ export function BlockSettingsMenu( { clientIds, ...props } ) { | |||
{ ( toggleProps ) => ( | |||
<BlockSettingsDropdown | |||
clientIds={ clientIds } | |||
toggleProps={ toggleProps } | |||
toggleProps={ { ...toggleProps, size: 'compact' } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some instances, like here, we'll override the size
coming from the current toggleProps
.
In others, we'll prioritize the user value:
size: 'compact', |
Is there a reason for this discrepancy, and should we treat them consistently?
@@ -334,6 +334,7 @@ export const BlockSwitcher = ( { clientIds } ) => { | |||
} | |||
text={ blockIndicatorText } | |||
toggleProps={ { | |||
size: 'compact', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -10,7 +10,7 @@ exports[`BlockVerticalAlignmentUI should match snapshot when controls are hidden | |||
aria-expanded="false" | |||
aria-haspopup="true" | |||
aria-label="Change vertical alignment" | |||
class="components-button components-dropdown-menu__toggle has-icon" | |||
class="components-button components-dropdown-menu__toggle is-compact has-icon" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
toggleProps={ { | ||
size: 'compact', | ||
...toolbarItemProps, | ||
} } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -28,6 +28,7 @@ function ToolbarGroupCollapsed( { | |||
controls={ controls } | |||
toggleProps={ { | |||
...internalToggleProps, | |||
size: 'compact', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -120,6 +132,9 @@ function UnconnectedDropdownMenu( dropdownMenuProps: DropdownMenuProps ) { | |||
return ( | |||
<Toggle | |||
{ ...mergedToggleProps } | |||
{ ...( toggleProps?.as === undefined | |||
? { __shouldNotWarnDeprecated36pxSize: true } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to prevent a redundant warning from Button
when DropdownMenu
has already warned.
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we miss to address a few instances, or is that intentional?
gutenberg/packages/block-editor/src/components/block-variation-transforms/index.js
Line 86 in 86a3bc9
toggleProps={ { iconPosition: 'right' } } |
gutenberg/packages/block-editor/src/components/image-editor/aspect-ratio-dropdown.js
Line 80 in 86a3bc9
toggleProps={ toggleProps } |
gutenberg/packages/block-editor/src/components/inserter/media-tab/media-preview.js
Lines 52 to 57 in 86a3bc9
<DropdownMenu | |
className="block-editor-inserter__media-list__item-preview-options" | |
label={ __( 'Options' ) } | |
popoverProps={ MEDIA_OPTIONS_POPOVER_PROPS } | |
icon={ moreVertical } | |
> |
gutenberg/packages/block-editor/src/components/rich-text/format-toolbar/index.js
Lines 49 to 58 in 86a3bc9
toggleProps={ { | |
...toggleProps, | |
className: clsx( | |
toggleProps.className, | |
{ 'is-pressed': hasActive } | |
), | |
description: __( | |
'Displays more block tools' | |
), | |
} } |
gutenberg/packages/block-library/src/image/image.js
Lines 125 to 128 in 20a9a81
toggleProps={ { | |
...toggleProps, | |
description: __( 'Displays more controls.' ), | |
} } |
gutenberg/packages/block-library/src/navigation/edit/leaf-more-menu.js
Lines 117 to 124 in 20a9a81
<DropdownMenu | |
icon={ moreVertical } | |
label={ __( 'Options' ) } | |
className="block-editor-block-settings-menu" | |
popoverProps={ POPOVER_PROPS } | |
noIcons | |
{ ...props } | |
> |
gutenberg/packages/components/src/tabs/stories/index.story.tsx
Lines 405 to 424 in eb01c74
<DropdownMenu | |
controls={ [ | |
{ | |
onClick: () => setSelectedTabId( 'tab1' ), | |
title: 'Tab 1', | |
isActive: selectedTabId === 'tab1', | |
}, | |
{ | |
onClick: () => setSelectedTabId( 'tab2' ), | |
title: 'Tab 2', | |
isActive: selectedTabId === 'tab2', | |
}, | |
{ | |
onClick: () => setSelectedTabId( 'tab3' ), | |
title: 'Tab 3', | |
isActive: selectedTabId === 'tab3', | |
}, | |
] } | |
label="Choose a tab. The power is yours." | |
/> |
return <DropdownMenu { ...props } />; |
gutenberg/packages/components/src/toolbar/toolbar-item/README.md
Lines 37 to 42 in 5c7f039
<DropdownMenu | |
icon={ table } | |
toggleProps={ toolbarItemHTMLProps } | |
label={ 'Edit table' } | |
controls={ [] } | |
/> |
gutenberg/packages/edit-site/src/components/global-styles/font-library-modal/font-collection.js
Lines 265 to 277 in 5c7f039
<DropdownMenu | |
icon={ moreVertical } | |
label={ __( 'Actions' ) } | |
popoverProps={ { | |
position: 'bottom left', | |
} } | |
controls={ [ | |
{ | |
title: __( 'Revoke access to Google Fonts' ), | |
onClick: revokeAccess, | |
}, | |
] } | |
/> |
gutenberg/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js
Lines 41 to 46 in 5c7f039
<DropdownMenu | |
className="sidebar-navigation__more-menu" | |
label={ __( 'Actions' ) } | |
icon={ moreVertical } | |
popoverProps={ POPOVER_PROPS } | |
> |
Lines 80 to 87 in 5c7f039
<DropdownMenu | |
icon={ moreVertical } | |
label={ __( 'Options' ) } | |
className="block-editor-block-settings-menu" | |
popoverProps={ POPOVER_PROPS } | |
noIcons | |
{ ...props } | |
> |
gutenberg/packages/editor/src/components/collab-sidebar/comments.js
Lines 281 to 289 in eb01c74
<DropdownMenu | |
icon={ moreVertical } | |
label={ _x( | |
'Select an action', | |
'Select comment action' | |
) } | |
className="editor-collab-sidebar-panel__comment-dropdown-menu" | |
controls={ moreActions } | |
/> |
gutenberg/packages/patterns/src/components/pattern-overrides-block-controls.js
Lines 100 to 103 in eb01c74
toggleProps={ { | |
description: blockDescription, | |
...toggleProps, | |
} } |
gutenberg/packages/preferences/README.md
Line 144 in 5c7f039
<DropdownMenu> |
<DropdownMenu | |
icon={ moveTo } | |
label={ __( 'Move to widget area' ) } | |
toggleProps={ toggleProps } | |
> |
I suppose we intentionally skipped these with a different prior size
:
gutenberg/packages/block-library/src/navigation/edit/navigation-menu-selector.js
Lines 148 to 152 in 5c7f039
<DropdownMenu | |
label={ selectorLabel } | |
icon={ moreVertical } | |
toggleProps={ { size: 'small' } } | |
> |
gutenberg/packages/components/src/palette-edit/index.tsx
Lines 489 to 499 in 20a9a81
<DropdownMenu | |
icon={ moreVertical } | |
label={ | |
isGradient | |
? __( 'Gradient options' ) | |
: __( 'Color options' ) | |
} | |
toggleProps={ { | |
size: 'small', | |
} } | |
> |
gutenberg/packages/components/src/tools-panel/tools-panel-header/component.tsx
Lines 196 to 205 in eb01c74
<DropdownMenu | |
{ ...dropdownMenuProps } | |
icon={ dropDownMenuIcon } | |
label={ dropDownMenuLabelText } | |
menuProps={ { className: dropdownMenuClassName } } | |
toggleProps={ { | |
size: 'small', | |
description: dropdownMenuDescriptionText, | |
} } | |
> |
gutenberg/packages/edit-site/src/components/sidebar-dataviews/custom-dataviews-list.js
Lines 116 to 126 in 5c7f039
<DropdownMenu | |
icon={ moreVertical } | |
label={ __( 'Actions' ) } | |
className="edit-site-sidebar-dataviews-dataview-item__dropdown-menu" | |
toggleProps={ { | |
style: { | |
color: 'inherit', | |
}, | |
size: 'small', | |
} } | |
> |
or a specific variant
:
gutenberg/packages/edit-site/src/components/add-new-pattern/index.js
Lines 126 to 130 in eb01c74
toggleProps={ { | |
variant: 'primary', | |
showTooltip: false, | |
__next40pxDefaultSize: true, | |
} } |
Finally, I guess we don't need to add these props to the component tests?
@@ -18,7 +18,7 @@ export function BlockSettingsMenu( { clientIds, ...props } ) { | |||
{ ( toggleProps ) => ( | |||
<BlockSettingsDropdown | |||
clientIds={ clientIds } | |||
toggleProps={ toggleProps } | |||
toggleProps={ { ...toggleProps, size: 'compact' } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some instances, like here, we'll override the size
coming from the current toggleProps
.
In others, we'll prioritize the user value:
size: 'compact', |
Is there a reason for this discrepancy, and should we treat them consistently?
Part of #65751
Stacked on #68328
What?
Deprecate the 36px default size on default toggle button for DropdownMenu.
Also updates the consumers so they don't log warnings.
Testing Instructions
__next40pxDefaultSize
prop enabled