VisuallyHidden: Recommend @wordpress/ui and migrate usages#77575
Conversation
|
Size Change: +12.7 kB (+0.16%) Total Size: 7.78 MB 📦 View Changed
ℹ️ View Unchanged
|
|
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. |
| <VisuallyHidden | ||
| as="label" | ||
| htmlFor={ `post-content-${ instanceId }` } | ||
| > |
There was a problem hiding this comment.
This instance still needs to be migrated
There was a problem hiding this comment.
No type checking in some of these packages are going to be annoying with migrations. Agent migrations are missing spots even after multiple rounds 😞
# Conflicts: # packages/block-editor/src/components/block-mover/button.js
| as="span" | ||
| className="dataviews-view-activity__item-field-label" | ||
| render={ | ||
| <span className="dataviews-view-activity__item-field-label" /> |
There was a problem hiding this comment.
Nit: for consistency, should className always be applied on VisuallyHidden, or always on the rendered element? Currently we're doing both.
There was a problem hiding this comment.
Fixed, but I'm tempted to remove all those class names 😅 What is a class name doing on a visually hidden element?? Alas, out of scope.
|
Flaky tests detected in e8a9164. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24888260974
|
* VisuallyHidden: Update guidance * Migrate instances * Add manifest tag * Migrate remaining VisuallyHidden instances * Switch over lint disable for test file * Add ui tsconfig references * Update stale snapshot * Fixup * Fix CI type errors * Fixup * Fix VisuallyHidden render props * Tweak * Fix missed spots * Add changelog * Keep `className` on host component Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: simison <87168+simison@users.noreply.github.com>
|
@talldan Thanks for reporting. Looks like we need some special handling for the iframes. I'll look into it. |
|
Fix for iframed styles in #77965 |


What?
Update the
VisuallyHiddenguidance to recommend@wordpress/ui, then migrate the remaining runtime usages over to that package.Why?
VisuallyHiddenis part of the migration away from legacy@wordpress/componentsexports. This branch aligns the lint rule, Storybook guidance, and package dependencies with that direction, while keeping one explicit legacy import in the DOM test for comparison coverage.How?
@wordpress/componentsVisuallyHiddenas not recommended and allow@wordpress/uiVisuallyHiddenin the recommended-components ruleVisuallyHiddenStorybook metadata so the@wordpress/uistory is manifested and the@wordpress/componentsstory points consumers to@wordpress/ui@wordpress/ui, add the required package dependencies, and keep the legacy import only in the targetedblock-editorDOM test with the lint exemption moved to that test pathTesting Instructions
npm run lint:js -- packages/block-editor/src/components packages/block-editor/src/utils/test/dom.js packages/block-library/src packages/block-directory/src packages/customize-widgets/src packages/dataviews/src packages/edit-post/src packages/edit-site/src packages/edit-widgets/src packages/editor/src packages/fields/src.rg "VisuallyHidden" packagesand confirm the only remaining@wordpress/componentsimport is the intentional one inpackages/block-editor/src/utils/test/dom.js.packages/ui/src/visually-hidden/stories/index.story.tsxis manifested andpackages/components/src/visually-hidden/stories/index.story.tsxis marked not recommended.Use of AI Tools
Cursor assisted with implementation, review prep, and PR drafting.