Skip to content

Commit

Permalink
Ignore NaN values in useUnimpededRangedNumberEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
stokesman committed May 10, 2022
1 parent 085fd03 commit 29634d7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/components/src/range-control/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ export function useUnimpededRangedNumberEntry( { max, min, onChange, value } ) {
/** @type {import('../input-control/types').InputChangeCallback}*/
const changeHandler = ( next ) => {
next = parseFloat( next );
const isOverflow = next < min || next > max;
isDiverging.current = isNaN( next ) || isOverflow;
if ( isOverflow ) {
if ( next < min || next > max ) {
isDiverging.current = true;
next = Math.max( min, Math.min( max, next ) );
}
onChange( next );
Expand Down

0 comments on commit 29634d7

Please sign in to comment.