diff --git a/.storybook/snapshots/__snapshots__/mapboxmap--custom-pin.png b/.storybook/snapshots/__snapshots__/mapboxmap--custom-pin.png index d6113c780..0d49ddd19 100644 Binary files a/.storybook/snapshots/__snapshots__/mapboxmap--custom-pin.png and b/.storybook/snapshots/__snapshots__/mapboxmap--custom-pin.png differ diff --git a/.storybook/snapshots/__snapshots__/mapboxmap--custom-render-pin.png b/.storybook/snapshots/__snapshots__/mapboxmap--custom-render-pin.png index d6113c780..0d49ddd19 100644 Binary files a/.storybook/snapshots/__snapshots__/mapboxmap--custom-render-pin.png and b/.storybook/snapshots/__snapshots__/mapboxmap--custom-render-pin.png differ diff --git a/.storybook/snapshots/__snapshots__/mapboxmap--multiple-pins.png b/.storybook/snapshots/__snapshots__/mapboxmap--multiple-pins.png index 18222fd51..572c0acb3 100644 Binary files a/.storybook/snapshots/__snapshots__/mapboxmap--multiple-pins.png and b/.storybook/snapshots/__snapshots__/mapboxmap--multiple-pins.png differ diff --git a/.storybook/snapshots/__snapshots__/mapboxmap--primary.png b/.storybook/snapshots/__snapshots__/mapboxmap--primary.png index ff3886440..de2d331c3 100644 Binary files a/.storybook/snapshots/__snapshots__/mapboxmap--primary.png and b/.storybook/snapshots/__snapshots__/mapboxmap--primary.png differ diff --git a/package-lock.json b/package-lock.json index 72c4bb1f2..32130f371 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/search-ui-react", - "version": "1.6.4", + "version": "1.6.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/search-ui-react", - "version": "1.6.4", + "version": "1.6.5", "license": "BSD-3-Clause", "dependencies": { "@restart/ui": "^1.0.1", diff --git a/package.json b/package.json index 715cfd0ec..effab8c60 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/search-ui-react", - "version": "1.6.4", + "version": "1.6.5", "description": "A library of React Components for powering Yext Search integrations", "author": "slapshot@yext.com", "license": "BSD-3-Clause", diff --git a/src/components/Dropdown/Dropdown.tsx b/src/components/Dropdown/Dropdown.tsx index b01fd9b0e..f9596bfd0 100644 --- a/src/components/Dropdown/Dropdown.tsx +++ b/src/components/Dropdown/Dropdown.tsx @@ -64,7 +64,7 @@ export function Dropdown(props: PropsWithChildren): JSX.Element { } = props; const containerRef = useRef(null); - const screenReaderUUID = useId(); + const screenReaderUUID = useId('dropdown'); const [screenReaderKey, setScreenReaderKey] = useState(0); const [hasTyped, setHasTyped] = useState(false); const [childrenWithDropdownItemsTransformed, items] = useMemo(() => { @@ -295,4 +295,4 @@ function getTransformedChildrenAndItemData(children: ReactNode): [ReactNode, Dro return createElement(DropdownItemWithIndex, { ...props, index: items.length - 1 }); })); return [childrenWithDropdownItemsTransformed, items]; -} \ No newline at end of file +} diff --git a/src/components/Filters/CheckboxOption.tsx b/src/components/Filters/CheckboxOption.tsx index 87843d2d0..7081a345e 100644 --- a/src/components/Filters/CheckboxOption.tsx +++ b/src/components/Filters/CheckboxOption.tsx @@ -79,7 +79,7 @@ export function CheckboxOption(props: CheckboxOptionProps): JSX.Element | null { resultsCount } = props; const cssClasses = useComposedCssClasses(builtInCssClasses, props.customCssClasses); - const optionId = useId(); + const optionId = useId('facet'); const { selectFilter, filters, applyFilters } = useFiltersContext(); const handleClick = useCallback((checked: boolean) => { diff --git a/src/hooks/useId.ts b/src/hooks/useId.ts index daa443db8..659b5603e 100644 --- a/src/hooks/useId.ts +++ b/src/hooks/useId.ts @@ -6,9 +6,9 @@ import { useLayoutEffect } from "./useLayoutEffect"; let serverHandoffComplete = false; let id = 0; -function genId(): string { +function genId(baseName: string): string { ++id; - return id.toString(); + return baseName + '-' + id.toString(); } // Workaround for https://github.com/webpack/webpack/issues/14814 @@ -28,14 +28,14 @@ const maybeReactUseId: undefined | (() => string) = (React as any)[ * @see Docs https://reach.tech/auto-id */ -export function useId(): string { +export function useId(baseName: string): string { if (maybeReactUseId !== undefined) { return maybeReactUseId(); } // If this instance isn't part of the initial render, we don't have to do the // double render/patch-up dance. We can just generate the ID and return it. - const initialId = (serverHandoffComplete ? genId() : ''); + const initialId = (serverHandoffComplete ? genId(baseName) : ''); const [id, setId] = useState(initialId); useLayoutEffect(() => { @@ -44,7 +44,7 @@ export function useId(): string { // rendering flicker, though it'll make the first render slower (unlikely // to matter, but you're welcome to measure your app and let us know if // it's a problem). - setId(genId()); + setId(genId(baseName)); } }, [id]);