gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

RangeControl not updating

Open andreg opened this issue 7 years ago • 2 comments

Describe the bug

I have connected the value I normally manage with a RangeControl to a different input field; normally one of the two would be hidden, but for the sake of reporting this bug, I'm attaching a GIF that displays both elements.

Since both the RangeControl and the additional input field I have created are managing the same block property, when I modify a value from the RangeControl, the input field is also updated. However, when I modify the input field directly, only the input field in the RangeControl component is updated, while the slider seems to always reset to the initial state of the component.

To Reproduce

Click on the image to see what I did:

Range-Control-not-updating

Expected behavior

I'd expect that the RangeControl slider would update according to the input value, even when not directly writing in the input field.

Desktop (please complete the following information):

  • OS: macOS
  • Browser Chrome
  • Version 71

Additional context

Tested on WordPress 5.0.3.

andreg avatar Jan 28 '19 10:01 andreg

Not sure if this is relevant or not, but I've solved the issue by making sure to cast the saved value to Number, since the component uses the isFinite function internally.

andreg avatar Jan 28 '19 10:01 andreg

Hi @andreg,

Not sure if this is relevant or not, but I've solved the issue by making sure to cast the saved value to Number, since the component uses the isFinite function internally.

Thank you for documenting the fix you found. You are totaly right the component does not works as expected if the value prop passed to it is not a number. The documentation of the component specified that the type of value shoud be a number, so I will close this issue or now. If you think an imporvement could be mande in Gutenberg code/documentation related to this issue feel free to reopen the issue.

jorgefilipecosta avatar Jan 28 '19 15:01 jorgefilipecosta