You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Components: update the rounding logic for shift key increments in NumberControl and RangeControl #34817
Update the rounding logic for when the user increments/decrements the value in NumberControl and RangeControl components while holding the shift key.
Currently, the result of a shift increment/decrement is rounded to the nearest multiple of the shift step value.
Current behaviour
Target updated behavior
Why
Make the shift increment more predictable for the NumberControl and RangeControl components by applying the shift step increment/decrement with the same rounding as the base step operation.
A/C
Apply the same rounding as the base step operation to the shift step increment/decrement
After Directly handle shift-stepping in RangeControl #34719, NumberControl is the only component using the useJumpStep hook. We should consider removing that function, and replace it with a new utility that enables sharing the new shift-stepping, rounding logic between NumberControl and RangeControl
Consider updating both component's READMEs (if necessary)
Consider adding an entry to the components package's CHANGELOG
Thanks for making the issue @ciampo 👍 It captures the intent. I put in the minor edit to say the shift-step will be applied with the same rounding as the base step.
Thanks for the ping and for writing up the current state of things!
We could refactor them to TypeScript
We should write more tests
Personally I'd prioritise these over following up with the shift-stepping behaviour in NumberControl.
For next steps around shift-stepping, I'd lean toward keeping things as they currently are. I don't think it's worth the trouble adding it back into RangeControl (since it doesn't really seem that beneficial for that component), and if the behaviour is currently working okay in NumberControl, there probably isn't any urgency in removing it. That said, if it isn't something used by users, it's nice to remove unnecessary code and simplify things where we can. But I don't feel strongly about it if anyone has other preferences 🙂
We should probably remove the useJumpStep functionality (it can always be added back later on)
Personally I'd prioritise these over following up with the shift-stepping behaviour in NumberControl.
[...]
For next steps around shift-stepping, I'd lean toward keeping things as they currently are
Closing as we're now focusing our efforts on the @wordpress/ui packages, providing new Input components that will replace / superseed the @wordpress/components ones. (cc @mirka in case there is anything in this PR that we can take inspiration from for the new components)
Activity
ciampo commentedon Sep 14, 2021
Hey @stokesman , can you please check this issue's description and confirm it's in line with what you initially described in #34542 ?
stokesman commentedon Sep 14, 2021
Thanks for making the issue @ciampo 👍 It captures the intent. I put in the minor edit to say the shift-step will be applied with the same rounding as the base step.
ciampo commentedon Oct 11, 2021
Update: after #35020 and #34542, the situation is as follows:
RangeControl— which means that onlyNumberControlcurrently has ituseJumpStephas become dead code, sinceNnumberControlalso stopped using itWe should now think about the next steps:
useJumpStepfunctionality (it can always be added back later on)NumberControlas wellRangeControlTagging here a few folks that may want to share their opinion here: @jasmussen @diegohaz @mirka @jorgefilipecosta @ntsekouras @aaronrobertshaw @andrewserong
andrewserong commentedon Oct 12, 2021
Thanks for the ping and for writing up the current state of things!
Personally I'd prioritise these over following up with the shift-stepping behaviour in NumberControl.
For next steps around shift-stepping, I'd lean toward keeping things as they currently are. I don't think it's worth the trouble adding it back into RangeControl (since it doesn't really seem that beneficial for that component), and if the behaviour is currently working okay in NumberControl, there probably isn't any urgency in removing it. That said, if it isn't something used by users, it's nice to remove unnecessary code and simplify things where we can. But I don't feel strongly about it if anyone has other preferences 🙂
That sounds like a good idea to me 👍
ciampo commentedon Oct 12, 2021
I personally agree with both opinions.
Next steps then look like:
useJumpStep— done in Components: remove unuseduseJumpSteputility #35561NumberControlandRangeControlby:NumberControlandRangeControlciampo commentedon Sep 3, 2026
Closing as we're now focusing our efforts on the
@wordpress/uipackages, providing new Input components that will replace / superseed the@wordpress/componentsones. (cc @mirka in case there is anything in this PR that we can take inspiration from for the new components)