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: Reset button isn't disabled when expected #63061

Open
mirka opened this issue Jul 2, 2024 · 0 comments
Open

RangeControl: Reset button isn't disabled when expected #63061

mirka opened this issue Jul 2, 2024 · 0 comments
Labels
[Package] Components /packages/components [Type] Bug An existing feature does not function as intended

Comments

@mirka
Copy link
Member

mirka commented Jul 2, 2024

The reset button when allowReset={ true } is not disabled when the value cannot be reset anymore.

For example in this story, with initialPosition={ 50 }:

CleanShot.2024-07-02.at.23.47.02-converted.mp4

The disable logic looks wrong, because value is number | null and will never be undefined:

disabled={ disabled || value === undefined }

There should probably be some consolidation with the handleOnReset logic, so that the reset button will be disabled when the resetValue is null:

const handleOnReset = () => {
let resetValue: number | null = parseFloat( `${ resetFallbackValue }` );
let onChangeResetValue: number | undefined = resetValue;
if ( isNaN( resetValue ) ) {
resetValue = null;

@mirka mirka added [Type] Enhancement A suggestion for improvement. [Type] Bug An existing feature does not function as intended [Package] Components /packages/components and removed [Type] Enhancement A suggestion for improvement. labels Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Components /packages/components [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant