Skip to content

Commit f946dac

Browse files
mdodgelookerLuke Bowerman
authored andcommitted
Fix InputText mousedown issue (#1734)
1 parent 2496d6a commit f946dac

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

packages/components/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.9.30]
9+
10+
### Fixed
11+
12+
- `InputText` issue moving cursor and selecting text when input is already focused
13+
814
## [0.9.29]
915

1016
### Fixed

packages/components/src/Form/Inputs/InputText/InputText.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ const InputTextLayout = forwardRef(
126126
// Avoid moving focus if the mousedown was inside a button
127127
// because it will interrupt any onclick behavior
128128
// (the button click handler should be responsible for moving focus)
129-
if (!targetIsButton(e)) {
129+
// Also no need to do anything if mousedown was on the input itself
130+
if (!targetIsButton(e) && e.target !== internalRef.current) {
130131
// set focus to input on mousedown of container to mimic natural input behavior
131132
// need requestAnimationFrame here due to browser updating focus _after_ mousedown is called
132133
if (document.activeElement === internalRef.current) {

0 commit comments

Comments
 (0)