-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 component: disable when value is out of bounds #60633
Comments
I discussed this with @DaniGuardiola for a second opinion, and we agreed that this a UI smell that tells us we're using a slider for something that shouldn't use a slider. Like the HTML attribute If you still want to do some custom ad hoc overriding of component internals to achieve this (e.g. in cc @WordPress/gutenberg-design |
Also removing the Bug tag, since in the RangeControl component the number input and slider will always maintain the same range, as defined by the |
The slider is a greatly ergonomical tool to set margins and paddings, I'd hate for us to have to remove it, that's why I think if you're intentionally typing in negative numbers, or very high numbers that break those bounds, disabling the slider would be a good way to allow both, and adhere to the spirit of the statement. Most of the time you shouldn't have huge values, or use negative values, that's why we'd require typing them in, and providing a bounded range is a useful additional guardrail. I remember replacing headings with SVG fonts back in the day before web-fonts, and moving the actual text content -9999px to the left to still be legible by screen readers. This is a CSS practice that we want to be able to support. But it seems unreasonable to me to remove the slider as a result. |
I agree with @mirka.
|
Would it be strange if the range min/max updated based on the input value? So if you manually enter -999 then the range would be -999 to 300. A provocation; should the order of the range / input should be visually flipped? If the slider is supposed to be the more ergonomic control, then shouldn't it be emphasised over the input, which is for edge case/custom values? If this is not the case then I tend to agree it's probably not adding a lot of value. |
Then 300 would still be a limit on the max value |
Description
As reported by @afercia here, The RangeControl component right now is inconsistent with the value next to it if it allows for a different range than the slider does. This is happening right now on spacing controls like margin and padding, since the slider's range is 0-300 but the input allows any value to infinity (and negative numbers possibly soon). Changing the range of the slider is not possible so lets disable it when the value in the input is out of bounds.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: