-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Deprecate DimensionControl
#64951
Deprecate DimensionControl
#64951
Conversation
import { | ||
DimensionControl, | ||
} from '@wordpress/components'; |
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 ResponsiveBlockControl
component itself is also obsolete, but updating the example in this readme anyway.
Here is a story if you want to see what this component does:
/**
* WordPress dependencies
*/
import { useState } from '@wordpress/element';
/**
* Internal dependencies
*/
import ResponsiveBlockControl from '../';
export default {
title: 'BlockEditor/ResponsiveBlockControl',
component: ResponsiveBlockControl,
};
export const Default = () => {
const [ isResponsive, setIsResponsive ] = useState( false );
return (
<ResponsiveBlockControl
title="Padding"
property="padding"
isResponsive={ isResponsive }
onIsResponsiveChange={ () => {
setIsResponsive( ! isResponsive );
} }
renderDefaultControl={ ( labelComponent, viewport ) => {
return (
<>
<label htmlFor={ viewport.id }>
{ labelComponent }
</label>
<input type="number" id={ viewport.id } />
</>
);
} }
/>
);
};
@@ -1,5 +1,9 @@ | |||
# DimensionControl | |||
|
|||
<div class="callout callout-alert"> | |||
This component is deprecated. |
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.
I'm refraining from issuing any "Use ___ instead" guidance, because nobody uses this anyway (also I don't know 😇).
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.
At most we could say "Use SelectControl
or CustomSelectControl
with and pass this set of options"
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.
Given that the original code example is for padding, I'm guessing most extenders would just use a Dimensions hook now. Doesn't cover the responsive case though 😕
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. |
Size Change: +11 B (0%) Total Size: 1.78 MB
ℹ️ View Unchanged
|
Flaky tests detected in 44142aa. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10639001609
|
@@ -3,6 +3,7 @@ | |||
const PREVIOUSLY_EXPERIMENTAL_COMPONENTS = [ | |||
'alignmentmatrixcontrol', | |||
'customselectcontrol-v2', | |||
'dimensioncontrol', |
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.
Is this redirect going to work? Usually we change from "experimental" to "stable", but in this instance we're changing to "deprecated" — would this affect the new URL?
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.
Unless I misunderstand, this is unnecessary.
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.
Good question. For the components moved to the Deprecated section, we're explicitly setting an id in the story meta so it won't include the word "deprecated" in the URL.
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.
LGTM 👍
Should we also remove it from the documentation:
Lines 824 to 829 in ade27ac
{ | |
"title": "DimensionControl", | |
"slug": "dimension-control", | |
"markdown_source": "../packages/components/src/dimension-control/README.md", | |
"parent": "components" | |
}, |
I wasn't sure about it, since I don't see any deprecated components being ignored from docs, but then, we also don't have many hard-deprecated components:
gutenberg/docs/tool/manifest.js
Lines 14 to 21 in 4119044
ignore: [ | |
'**/src/mobile/**/README.md', | |
'packages/components/src/theme/README.md', | |
'packages/components/src/view/README.md', | |
'packages/components/src/dropdown-menu-v2/README.md', | |
'packages/components/src/tabs/README.md', | |
'packages/components/src/custom-select-control-v2/README.md', | |
], |
I think we are obligated to keep it around until we actually delete the export from the package. |
Part of #59418
What?
Deprecates the
DimensionControl
component, scheduled to be hard removed in WP 7.0.Why?
There is virtually no usage of this component, neither in Gutenberg nor the ecosystem.
✍️ Dev note
The
DimensionControl
component is now marked as deprecated and scheduled for removal in the WordPress 7.0 release.Usages of
DimensionControl
can be replaced withSelectControl
andCustomSelectControl
, passing an array of dimension options to the components.