Skip to content

Commit

Permalink
[TextField] Fix input focus loss on vertical content change (#5931)
Browse files Browse the repository at this point in the history
* [TextField] Fix input focus loss on vertical content change

* Add changeset
  • Loading branch information
laurkim committed May 26, 2022
1 parent 56b8ca7 commit 87b4890
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/sour-readers-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': minor
---

Fixed input focus loss in TextField on vertical content change
2 changes: 1 addition & 1 deletion polaris-react/src/components/TextField/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export function TextField({
const input = inputRef.current;
if (!input || focused === undefined) return;
focused ? input.focus() : input.blur();
}, [focused]);
}, [focused, verticalContent]);

useEffect(() => {
const input = inputRef.current;
Expand Down

0 comments on commit 87b4890

Please sign in to comment.