diff --git a/change/@fluentui-react-7286e07c-b484-4545-a09e-fc93cdb6dea1.json b/change/@fluentui-react-7286e07c-b484-4545-a09e-fc93cdb6dea1.json new file mode 100644 index 0000000000000..185d610348e95 --- /dev/null +++ b/change/@fluentui-react-7286e07c-b484-4545-a09e-fc93cdb6dea1.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "fix(AutoFill): Do not clear input when pressing left arrow after typing.", + "packageName": "@fluentui/react", + "email": "chebbim106@gmail.com", + "dependentChangeType": "patch" +} diff --git a/packages/react/src/components/Autofill/Autofill.tsx b/packages/react/src/components/Autofill/Autofill.tsx index 723c41b3929e7..5b5ebb4a3635f 100644 --- a/packages/react/src/components/Autofill/Autofill.tsx +++ b/packages/react/src/components/Autofill/Autofill.tsx @@ -255,7 +255,9 @@ export class Autofill extends React.Component im case KeyCodes.left: case KeyCodes.right: if (this._autoFillEnabled) { - this.setState({ inputValue: this.props.suggestedDisplayValue || '' }); + this.setState(prev => ({ + inputValue: this.props.suggestedDisplayValue || prev.inputValue, + })); this._autoFillEnabled = false; } break;