Skip to content

Commit

Permalink
Help Center: Don't auto focus on the input on custom home (#91441)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur791004 committed Jun 4, 2024
1 parent 6bef953 commit b0d0b4f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/blocks/inline-help/inline-help-search-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ type Props = {
onSearch?: ( query: string ) => void;
};

const AUTO_FOCUS_LOCATION = [ 'help-center', 'inline-help-popover' ];

const InlineHelpSearchCard = ( {
searchQuery = '',
location = 'inline-help-popover',
Expand All @@ -35,7 +37,7 @@ const InlineHelpSearchCard = ( {
// Focus in the input element.
useEffect( () => {
const inputElement = cardRef.current?.searchInput;
if ( ! inputElement || ! isVisible ) {
if ( ! AUTO_FOCUS_LOCATION.includes( location ) || ! inputElement || ! isVisible ) {
return;
}

Expand Down

0 comments on commit b0d0b4f

Please sign in to comment.