Skip to content

Forms: Update slider default and increment controls #44803

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

Merged
merged 4 commits into from
Aug 18, 2025

Conversation

edanzer
Copy link
Contributor

@edanzer edanzer commented Aug 14, 2025

Partially addresses FORMS-66

Proposed changes:

This updates controls for the new Slider field block to match designs. Specifically:

  • Updates the 'default value' control to be a number input rather than range
  • Uses HStack to position 'default value' and 'increment' together on a row
  • Adds CSS to ensure the numbers controls for the min/max and default/increment roles are each 50%
  • Fixes a small bug where increment value was going up by factors of 2 (1,2,4,8,16) vs 1 (1,2,3,4,5)

Before
slider-increment

After
slider-default-increment-after

Original designs
slider-designs

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

None.

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

No.

Testing instructions:

  • Enable beta blocks: define( 'JETPACK_BLOCKS_VARIATION', 'beta' );
  • Note: You may need to run jetpack build packages/forms to get the frontend slider-field.css to be built and loaded in the dist directory. Having the watch command running is not sufficient.
  • Add a form to a page or post
  • Add a new Slider block and be sure the field (not input) is selected
  • Confirm 'default value' control is now a number input and works as expected
  • Confirm 'increment' control works as expected
  • Confirm 'default' and 'increment' controls are on the same line, each 50% of width
  • Confirm min and max controls are on the same line, each 50% of the width
  • Play with min, max, default, and increment to be sure they behavior well together
  • Save, go to frontend, and confirm slider works as expected based on settings
  • With slider field selected, confirm the 'Increment' control shows in the sidebar
  • Try various combinations of min, max, default, and increment, and confirm increment works as expected
  • Save, go to frontend, and confirm that slider field works and obeys whatever increment you set

@edanzer edanzer requested a review from a team August 14, 2025 19:08
@edanzer edanzer self-assigned this Aug 14, 2025
Copy link
Contributor

github-actions bot commented Aug 14, 2025

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 a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ 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 Aug 14, 2025
Copy link
Contributor

github-actions bot commented Aug 14, 2025

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-slider-default-control branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/forms-slider-default-control

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

Copy link

jp-launch-control bot commented Aug 14, 2025

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@dhasilva dhasilva added [Status] Needs Review This PR is ready for review. [Type] Task 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 Aug 14, 2025
dhasilva
dhasilva previously approved these changes Aug 14, 2025
Copy link
Contributor

@dhasilva dhasilva left a comment

Choose a reason for hiding this comment

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

LGTM, works as described

@@ -0,0 +1,4 @@
/* Ensure equal width for paired controls in the slider field inspector */
.jp-field-slider-inspector-row.components-h-stack > div {
Copy link
Member

@simison simison Aug 15, 2025

Choose a reason for hiding this comment

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

It can come to bite is in future to use internal classes to components, as they might change in future.

Now to conflict a bit what I'm saying above, we could use __unstableInputWidth="100%" insetead. That can change/break, but not without warning, and the whole number field is marked as experimental.

Docs: https://wordpress.github.io/gutenberg/?path=/docs/components-numbercontrol--docs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I experimented with this for a bit, but that __unstableInputWidth is odd and I can't get it to work. For starters, based on the docs, it expects an object as an argument. I tried percentages in any case, but the percentage effects were inconsistent, so applying this to all the Number controls on this page did not give even, consistent size/spacing. For now, I removed .component-h-stack so we're just using our custom CSS. I know still not idea, but I'll push for now to keep it moving and revisit if worth doing so.

@edanzer edanzer force-pushed the update/forms-slider-default-control branch from 51d3b87 to 065bfd9 Compare August 15, 2025 19:09
@edanzer edanzer merged commit f7f0a04 into trunk Aug 18, 2025
68 checks passed
@edanzer edanzer deleted the update/forms-slider-default-control branch August 18, 2025 17:28
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Aug 18, 2025
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.

3 participants