Skip to content

Commit b7280f7

Browse files
committed
[FIX] GenericInput: skip focus manipulation
When providing the props `selectContentOnFocus`, we manipulate the default behaviour of the browser (mouseDown/mouseUp) to select the full content of the input. However, half of this manipulation (prevent mouseDown default) still occured even if the props `selectContentOnFocus` was set to false. Unfortunately, this cannot be properly tested as the update of the selected range on mouseDown does not seem programatically reproductible. closes #7383 Task: 5206980 Signed-off-by: Lucas Lefèvre (lul) <[email protected]>
1 parent 62b85c8 commit b7280f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/generic_input/generic_input.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ export class GenericInput<T extends GenericInputProps> extends Component<T, Spre
8383

8484
onMouseDown(ev: MouseEvent) {
8585
// Stop the event if the input is not focused, we handle everything in onMouseUp
86-
if (ev.target !== document.activeElement) {
86+
if (ev.target !== document.activeElement && this.props.selectContentOnFocus) {
8787
ev.preventDefault();
8888
ev.stopPropagation();
8989
}
9090
}
9191

9292
onMouseUp(ev: MouseEvent) {
9393
const target = ev.target as HTMLInputElement;
94-
if (target !== document.activeElement) {
94+
if (target !== document.activeElement && this.props.selectContentOnFocus) {
9595
target.focus();
9696
if (this.props.selectContentOnFocus) {
9797
target.select();

0 commit comments

Comments
 (0)