Skip to content

Commit

Permalink
Forcing focus on integration search input (#3917)
Browse files Browse the repository at this point in the history
  • Loading branch information
galvana authored Aug 11, 2023
1 parent 385bbec commit b218f3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The types of changes are:
- Fixed issue when generating masked values for invalid data paths (#3906)[https://github.com/ethyca/fides/pull/3906]
- Code reload now works when running `nox -s dev` (#3914)[https://github.com/ethyca/fides/pull/3914]
- Reduce verbosity of privacy center logging further (#3915)[https://github.com/ethyca/fides/pull/3915]
- Resolved an issue where the integration dropdown input lost focus during typing. (#3917)[https://github.com/ethyca/fides/pull/3917]

## [2.18.0](https://github.com/ethyca/fides/compare/2.17.0...2.18.0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
Tooltip,
} from "@fidesui/react";
import { debounce } from "common/utils";
import { useCallback, useMemo, useState } from "react";
import { useCallback, useMemo, useRef, useState } from "react";

import { useAppSelector } from "~/app/hooks";
import {
Expand Down Expand Up @@ -143,6 +143,8 @@ const ConnectionListDropdown: React.FC<SelectDropdownProps> = ({
onChange,
selectedValue,
}) => {
const inputRef = useRef<HTMLInputElement>(null);

// Hooks
const [isOpen, setIsOpen] = useState(false);
const [searchTerm, setSearchTerm] = useState("");
Expand All @@ -167,7 +169,8 @@ const ConnectionListDropdown: React.FC<SelectDropdownProps> = ({
const handleSearchChange = useCallback(
(event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.value.length === 0 || event.target.value.length > 1) {
setSearchTerm(event.target.value);
setSearchTerm(event.target.value.toLowerCase());
setTimeout(() => inputRef.current?.focus(), 0);
}
},
[]
Expand Down Expand Up @@ -229,6 +232,7 @@ const ConnectionListDropdown: React.FC<SelectDropdownProps> = ({
<SearchLineIcon color="gray.300" h="17px" w="17px" />
</InputLeftElement>
<Input
ref={inputRef}
autoComplete="off"
autoFocus
borderRadius="md"
Expand Down

0 comments on commit b218f3f

Please sign in to comment.