Skip to content

Forms: disable the non-functional device visibility control on fields and inputs#49973

Open
CGastrell wants to merge 3 commits into
trunkfrom
update/forms-disable-field-visibility-support
Open

Forms: disable the non-functional device visibility control on fields and inputs#49973
CGastrell wants to merge 3 commits into
trunkfrom
update/forms-disable-field-visibility-support

Conversation

@CGastrell

Copy link
Copy Markdown
Contributor

Proposed changes

Interim "disable" measure for FORMS-694 while we decide whether to fully support per-field device visibility.

  • The device/viewport visibility control ("Hide on desktop / tablet / mobile") shows up on Jetpack form fields but has no effect on the frontend: the field render pipeline flattens blocks into a shortcode-style array and bypasses core's render_block visibility filter (gutenberg_render_block_visibility_support), so the wp-block-hidden-* classes + generated media-query CSS are never applied to the field wrapper.
  • Rather than expose a control that does nothing, this disables the visibility block support on field and input blocks so the option no longer appears. Labels keep visibility support (they're handled separately via labelhiddenbyblockvisibility).
  • Applied consistently on both registrations:
    • JS — shared/settings/index.js (covers all field blocks) and input/index.js.
    • PHP — a register_block_type_args filter scoped to jetpack/input and jetpack/field-* (excluding the internal field-option-*), mirroring the JS.

Related

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • In the block editor, add a Form block and select a field (or its input). The "Hide / Hide on…" control should no longer be present.
  • Select a field's label — the visibility control is still available there (unchanged).
  • Select a non-form block (e.g. a paragraph) — visibility is unaffected.
  • Registration parity check: in the editor wp.blocks.hasBlockSupport( 'jetpack/field-name', 'visibility', true ) returns false, and server-side WP_Block_Type_Registry reports visibility=false for fields/input while labels and other blocks remain true.

Note

This is the lightweight "disable" path. The alternative — fully supporting per-field device visibility — would mean replicating core's gutenberg_render_block_visibility_support logic inside the forms render pipeline (the wp-block-hidden-* classes + style-engine media queries) and deciding how required-and-hidden fields interact with validation and the form token. Tracked in FORMS-694.

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the update/forms-disable-field-visibility-support branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/forms-disable-field-visibility-support

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@github-actions github-actions Bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Jun 25, 2026
@CGastrell CGastrell added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Jun 25, 2026
@CGastrell CGastrell self-assigned this Jun 25, 2026
@CGastrell CGastrell marked this pull request as ready for review June 25, 2026 14:23
@jp-launch-control

jp-launch-control Bot commented Jun 25, 2026

Copy link
Copy Markdown

Code Coverage Summary

Coverage changed in 1 file.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/blocks/contact-form/class-contact-form-block.php 610/674 (90.50%) 0.10% 0 💚

Full summary · PHP report · JS report

Device/viewport visibility ("Hide on…") is not honored on the field wrapper
at render time — the field render pipeline bypasses core's render_block
visibility filter — so the control did nothing. Disable the 'visibility'
block support on field and input blocks on both the JS (shared/settings,
input) and PHP (register_block_type_args filter) registrations so the
non-functional option no longer appears. Labels keep visibility support.

See FORMS-694.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@CGastrell CGastrell force-pushed the update/forms-disable-field-visibility-support branch from aa49d16 to 5d61ca2 Compare June 26, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant