Skip to content

Commit

Permalink
fix(react-search): Restore focus to SearchBox after clear button is…
Browse files Browse the repository at this point in the history
… clicked (#33340)
  • Loading branch information
emmayjiang authored Nov 26, 2024
1 parent 34423d6 commit 94f7b85
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix(react-search): restore focus to SearchBox after clear button is clicked",
"packageName": "@fluentui/react-search",
"email": "jiangemma@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export const useSearchBox_unstable = (props: SearchBoxProps, ref: React.Ref<HTML
const newValue = '';
setInternalValue(newValue);
props.onChange?.(event, { value: newValue });

searchBoxRef.current?.focus();
});

const inputState = useInput_unstable(
Expand Down

0 comments on commit 94f7b85

Please sign in to comment.