Skip to content

DataViews: vendor ValidatedToggleControl - #81492

Open
oandregal wants to merge 1 commit into
trunkfrom
update/vendor-toggle-control-into-dataviews
Open

DataViews: vendor ValidatedToggleControl#81492
oandregal wants to merge 1 commit into
trunkfrom
update/vendor-toggle-control-into-dataviews

Conversation

@oandregal

Copy link
Copy Markdown
Member

Part of #81230
Follow-up to #81391, #81433, #81434, #81435, #81449, #81450, #81451

What?

Vendors ValidatedToggleControl into @wordpress/dataviews as an internal component, and removes it from the @wordpress/components private APIs.

Why?

See #81230

How?

  • Adds packages/dataviews/src/components/validated-form-controls/toggle-control.tsx, wrapping the public ToggleControl from @wordpress/components with the already-vendored ControlWithError. Behavior is preserved exactly.

Testing Instructions

  1. npm run test:unit -- packages/dataviews/src/components/validated-form-controls/test/toggle-control.tsx — passes.
  2. npm run storybook:dev, then open DataViews → DataForm → Validation.
  3. Enable the toggle field in the story controls and mark it required.
  4. Try to submit without activating the toggle: the validation error message appears, wired to the control via aria-describedby.
  5. Activate the toggle: the error clears and the form submits.

Use of AI Tools

Authored with the assistance of Claude Code (Claude Fable 5). All changes were reviewed and verified by the author.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings August 12, 2026 10:02
@oandregal
oandregal requested review from a team, ajitbohra, gigitux and ntsekouras as code owners August 12, 2026 10:02
@github-actions

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: oandregal <oandregal@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

1 similar comment
@github-actions

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions github-actions Bot added [Package] Components /packages/components [Package] DataViews /packages/dataviews labels Aug 12, 2026
@oandregal oandregal added the [Type] Code Quality Issues or PRs that relate to code quality label Aug 12, 2026
@oandregal oandregal self-assigned this Aug 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Vendors ValidatedToggleControl into DataViews, eliminating its dependency on the Components private API while preserving validation behavior.

Changes:

  • Adds the internal DataViews validated toggle wrapper and tests.
  • Updates DataForm to use the local component.
  • Removes the Components private export and Storybook story.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/dataviews/src/components/validated-form-controls/toggle-control.tsx Implements the vendored wrapper.
packages/dataviews/src/components/validated-form-controls/test/toggle-control.tsx Moves validation accessibility tests.
packages/dataviews/src/components/validated-form-controls/index.ts Exports the internal wrapper.
packages/dataviews/src/components/dataform-controls/toggle.tsx Replaces private API usage.
packages/dataviews/CHANGELOG.md Records the internalization.
packages/components/src/validated-form-controls/components/stories/toggle-control.story.tsx Removes the obsolete story.
packages/components/src/validated-form-controls/components/index.ts Removes the Components export.
packages/components/src/private-apis.ts Removes private API registration.
packages/components/CHANGELOG.md Documents private API removal.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

export * from './content-editable-control';
export * from './textarea-control';
export * from './toggle-control';
export * from './toggle-group-control';

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Before merging this one, I'd like to confirm that a copy should not be kept in components (see).

@oandregal

Copy link
Copy Markdown
Member Author

Tested and this works like trunk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Components /packages/components [Package] DataViews /packages/dataviews [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants