Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

- Expose `normalizeTextString` method as private API ([#70178](https://github.com/WordPress/gutenberg/pull/70178)).
- Mark `withIgnoreIMEEvents()` function as private API ([#70056](https://github.com/WordPress/gutenberg/pull/70056)).
- `InputControl`: remove unnecessary forced focus on `mousedown` ([#41118](https://github.com/WordPress/gutenberg/pull/41118)).

## 29.10.0 (2025-05-22)

Expand All @@ -42,7 +43,7 @@
- `ToggleGroupControl`: Fix active background for empty string value ([#69969](https://github.com/WordPress/gutenberg/pull/69969)).
- `ItemGroup`: Fix double border in `ItemGroup` when last item is focused ([#70021](https://github.com/WordPress/gutenberg/pull/70021)).
- `__experimentalUseCustomUnits `: Don't mutate 'ALL_CSS_UNITS' default value ([#70037](https://github.com/WordPress/gutenberg/pull/70037)).
- `FocalPointPicker`: Fix SVG display when it doesn't provide a width attribute ([#70061](https://github.com/WordPress/gutenberg/pull/70061))..
- `FocalPointPicker`: Fix SVG display when it doesn't provide a width attribute ([#70061](https://github.com/WordPress/gutenberg/pull/70061))..

### Internal

Expand Down
18 changes: 0 additions & 18 deletions packages/components/src/input-control/input-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
PointerEvent,
FocusEvent,
ForwardedRef,
MouseEvent,
} from 'react';

/**
Expand Down Expand Up @@ -187,22 +186,6 @@ function InputField(
);

const dragProps = isDragEnabled ? dragGestureProps() : {};
/*
* Works around the odd UA (e.g. Firefox) that does not focus inputs of
* type=number when their spinner arrows are pressed.
*/
let handleOnMouseDown;
if ( type === 'number' ) {
handleOnMouseDown = ( event: MouseEvent< HTMLInputElement > ) => {
props.onMouseDown?.( event );
if (
event.currentTarget !==
event.currentTarget.ownerDocument.activeElement
) {
event.currentTarget.focus();
}
};
}

return (
<Input
Expand All @@ -216,7 +199,6 @@ function InputField(
onBlur={ handleOnBlur }
onChange={ handleOnChange }
onKeyDown={ withIgnoreIMEEvents( handleOnKeyDown ) }
onMouseDown={ handleOnMouseDown }
ref={ ref }
inputSize={ size }
// Fallback to `''` to avoid "uncontrolled to controlled" warning.
Expand Down
17 changes: 0 additions & 17 deletions packages/components/src/input-control/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,6 @@ describe( 'InputControl', () => {
} );
} );

describe( 'Ensurance of focus for number inputs', () => {
it( 'should focus its input on mousedown events', async () => {
const user = await userEvent.setup();
const spy = jest.fn();
render( <InputControl type="number" onFocus={ spy } /> );
const target = getInput();

// Hovers the input and presses (without releasing) primary button.
await user.pointer( [
{ target },
{ keys: '[MouseLeft]', target },
] );

expect( spy ).toHaveBeenCalledTimes( 1 );
} );
} );

describe( 'Value', () => {
it( 'should update value onChange', async () => {
const user = await userEvent.setup();
Expand Down
Loading