Skip to content

Commit 5bee7a4

Browse files
Merge pull request #1574 from ASU/UDS-2046
fix(app-webdir-ui): sanitize useId to generate accessible form field IDs
2 parents 9d68861 + 4c30f84 commit 5bee7a4

File tree

1 file changed

+4
-1
lines changed
  • packages/app-webdir-ui/src/SearchPage/components

1 file changed

+4
-1
lines changed

packages/app-webdir-ui/src/SearchPage/components/sort.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ import { SortLayout } from "./index.styles";
1616

1717
const SortPicker = ({ sort, onChange, customSortOptions }) => {
1818
const [defaultSortValue, setDefaultSortValue] = useState(sort);
19-
const sortLabelId = useId();
19+
20+
const rawSortLabelId = useId();
21+
const sortLabelId = `sortBy-${rawSortLabelId.replace(/[^a-zA-Z0-9-_]/g, "")}`;
22+
2023
const sortOptions = customSortOptions || [
2124
{ value: "_score_desc", label: "Relevancy" },
2225
{ value: "last_name_asc", label: "Last Name (ascending)" },

0 commit comments

Comments
 (0)