Skip to content

Commit 028b7ce

Browse files
Cursor should show at the end when clicking in dialpad textfield (#2576)
* move cursor to end * Change files * Duplicate change files for beta release * move cursor to end Co-authored-by: Donald McEachern <94866715+dmceachernmsft@users.noreply.github.com>
1 parent e7b12c4 commit 028b7ce

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Move cursor to the end of input when clicking on dialpad text field",
4+
"packageName": "@azure/communication-react",
5+
"email": "carolinecao@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Move cursor to the end of input when clicking on dialpad text field",
4+
"packageName": "@azure/communication-react",
5+
"email": "carolinecao@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

packages/react-components/src/components/Dialpad/Dialpad.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,15 @@ const DialpadContainer = (props: {
267267
onChange={(e: any) => {
268268
setText(e.target.value);
269269
}}
270+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
271+
onClick={(e: any) => {
272+
const input = e.target;
273+
const end = input.value.length;
274+
275+
// Move focus to end of input field
276+
input.setSelectionRange(end, end);
277+
input.focus();
278+
}}
270279
placeholder={props.strings.placeholderText}
271280
data-test-id="dialpad-input"
272281
onRenderSuffix={(): JSX.Element => (

0 commit comments

Comments
 (0)