Skip to content

Commit

Permalink
LineHeightControl: Make spin buttons adjust from placeholder value (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored Mar 17, 2023
1 parent 2febbb8 commit 7454469
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ const LineHeightControl = ( {
? undefined
: { marginBottom: 24 };

const handleOnChange = ( nextValue, { event } ) => {
if ( event.type === 'click' ) {
onChange( adjustNextValue( nextValue, false ) );
return;
}

onChange( nextValue );
};

return (
<div
className="block-editor-line-height-control"
Expand All @@ -93,7 +102,7 @@ const LineHeightControl = ( {
{ ...otherProps }
__unstableInputWidth={ __unstableInputWidth }
__unstableStateReducer={ stateReducer }
onChange={ onChange }
onChange={ handleOnChange }
label={ __( 'Line height' ) }
placeholder={ BASE_DEFAULT_VALUE }
step={ STEP }
Expand Down

1 comment on commit 7454469

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 7454469.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4444954556
📝 Reported issues:

Please sign in to comment.