Skip to content
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

RangeControl: tweak mark and label absolute positioning #64487

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Aug 14, 2024

What?

Resolves: #64481

This commit tweaks the position of the range control marks and labels to fit the original 2020 design.

Why?

I can't find the regression, but there seems to be one.

How?

Tweaky tweaky.

Testing Instructions

The easiest way to test is to run story book locally — npm run storybook:dev — and head to http://localhost:50240/?path=/story/components-rangecontrol--with-integer-step-and-marks

Check that that the marks and labels sit neat behind, and under the range control bar.

Compare with trunk: https://wordpress.github.io/gutenberg/?path=/story/components-rangecontrol--with-integer-step-and-marks

I also added some marks to existing block editor controls to check for side-effects.

Here's the Cover block opacity range control:

2024-08-14.12.34.04.mp4
Diff for the above cover block test
diff --git a/packages/block-library/src/cover/edit/inspector-controls.js b/packages/block-library/src/cover/edit/inspector-controls.js
index 5f93df58ad..54e1a7489a 100644
--- a/packages/block-library/src/cover/edit/inspector-controls.js
+++ b/packages/block-library/src/cover/edit/inspector-controls.js
@@ -291,8 +291,34 @@ export default function CoverInspectorControls( {
 							}
 							min={ 0 }
 							max={ 100 }
-							step={ 10 }
+							step={ 20 }
 							required
+							marks={ [
+								{
+									value: 0,
+									label: '0',
+								},
+								{
+									value: 20,
+									label: '20',
+								},
+								{
+									value: 40,
+									label: '40',
+								},
+								{
+									value: 60,
+									label: '60',
+								},
+								{
+									value: 80,
+									label: '80',
+								},
+								{
+									value: 100,
+									label: '100',
+								},
+							] }
 							__next40pxDefaultSize
 						/>
 					</ToolsPanelItem>

Screenshots or screencast

Before After
Screenshot 2024-08-14 at 12 23 30 PM Screenshot 2024-08-14 at 12 00 09 PM

@ramonjd ramonjd added [Type] Regression Related to a regression in the latest release [Package] Components /packages/components labels Aug 14, 2024
@ramonjd ramonjd requested a review from jameskoster August 14, 2024 02:35
@ramonjd ramonjd self-assigned this Aug 14, 2024
@ramonjd ramonjd requested a review from ajitbohra as a code owner August 14, 2024 02:35
Copy link

github-actions bot commented Aug 14, 2024

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: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>

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

@ramonjd ramonjd changed the title RangeControl: tweak mark and label positioning RangeControl: tweak mark and label absolute positioning Aug 14, 2024
@ramonjd ramonjd changed the title RangeControl: tweak mark and label absolute positioning RangeControl: tweak mark and label absolute positioning Aug 14, 2024
@tyxla tyxla requested a review from a team August 14, 2024 14:21
Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

Thank you for the tweaky tweak!

Rail edge is rounded even with a mark

Funny how this was so obviously broken for years and now that it's fixed I can't unsee this border radius detail 😂 It's definitely a separate issue though, since we'll have to detect whether there is a mark at each end point, which is not always true.

@ramonjd
Copy link
Member Author

ramonjd commented Aug 14, 2024

Thank you @mirka !

@ramonjd ramonjd force-pushed the update/range-control-mark-label-position branch from 699bfda to d8ae9c6 Compare August 14, 2024 23:45
@ramonjd ramonjd enabled auto-merge (squash) August 14, 2024 23:46
@ramonjd ramonjd merged commit 454129b into trunk Aug 15, 2024
61 checks passed
@ramonjd ramonjd deleted the update/range-control-mark-label-position branch August 15, 2024 00:20
@github-actions github-actions bot added this to the Gutenberg 19.1 milestone Aug 15, 2024
@ciampo ciampo mentioned this pull request Aug 15, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RangeControl: Mark positioning is buggy
2 participants