diff --git a/__tests__/src/components/WindowTopMenuButton.test.js b/__tests__/src/components/WindowTopMenuButton.test.js index baf91aef59..f49934dbe3 100644 --- a/__tests__/src/components/WindowTopMenuButton.test.js +++ b/__tests__/src/components/WindowTopMenuButton.test.js @@ -47,6 +47,6 @@ describe('WindowTopMenuButton', () => { render(); await user.click(screen.getByLabelText('Window views & thumbnail display')); // when 'open' is true, aria-owns is set to the id of the window - expect(screen.getByLabelText('Window views & thumbnail display')).toHaveAttribute('aria-owns', 'window-menu_xyz'); // eslint-disable-line testing-library/no-node-access + expect(screen.getByLabelText('Window views & thumbnail display')).toHaveAttribute('aria-owns'); // eslint-disable-line testing-library/no-node-access }); }); diff --git a/src/components/ManifestRelatedLinks.js b/src/components/ManifestRelatedLinks.js index 2169b68c1d..b6609ed3d0 100644 --- a/src/components/ManifestRelatedLinks.js +++ b/src/components/ManifestRelatedLinks.js @@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next'; import CollapsibleSection from '../containers/CollapsibleSection'; import ns from '../config/css-ns'; import { PluginHook } from './PluginHook'; +import { useId } from 'react'; const StyledDl = styled('dl')(({ theme }) => ({ '& dd': { @@ -28,18 +29,19 @@ export function ManifestRelatedLinks({ ...rest }) { const { t } = useTranslation(); + const titleId = useId(); + const pluginProps = { homepage, id, manifestUrl, related, renderings, seeAlso, t, ...rest, }; return ( diff --git a/src/components/SearchHit.js b/src/components/SearchHit.js index c656f4d147..de79d2126f 100644 --- a/src/components/SearchHit.js +++ b/src/components/SearchHit.js @@ -1,4 +1,4 @@ -import { useEffect, useMemo } from 'react'; +import { useEffect, useId, useMemo } from 'react'; import { useEffectEvent } from 'use-effect-event'; import PropTypes from 'prop-types'; import Button from '@mui/material/Button'; @@ -86,11 +86,12 @@ export function SearchHit({ ); }); + const canvasLabelHtmlId = useId(); + if (focused && !selected) return null; const renderedHit = focused ? hit : hit && truncatedHit; const truncated = hit && (renderedHit.before !== hit.before || renderedHit.after !== hit.after); - const canvasLabelHtmlId = `${companionWindowId}-${index}`; const ownerState = { adjacent, focused, selected, windowSelected, }; diff --git a/src/components/WindowListButton.js b/src/components/WindowListButton.js index 3134fa745e..451cf2bba7 100644 --- a/src/components/WindowListButton.js +++ b/src/components/WindowListButton.js @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useId, useState } from 'react'; import PropTypes from 'prop-types'; import BookmarksIcon from '@mui/icons-material/BookmarksSharp'; import { useTranslation } from 'react-i18next'; @@ -11,6 +11,7 @@ import MiradorMenuButton from '../containers/MiradorMenuButton'; export function WindowListButton({ disabled = false, windowCount }) { const { t } = useTranslation(); const [windowListAnchor, setWindowListAnchor] = useState(null); + const id = useId(); /** */ const handleClose = () => { setWindowListAnchor(null); }; @@ -22,7 +23,7 @@ export function WindowListButton({ disabled = false, windowCount }) { diff --git a/src/components/WindowSideBarCanvasPanel.js b/src/components/WindowSideBarCanvasPanel.js index 59953f2275..2b30297c4b 100644 --- a/src/components/WindowSideBarCanvasPanel.js +++ b/src/components/WindowSideBarCanvasPanel.js @@ -1,4 +1,4 @@ -import { useRef } from 'react'; +import { useId, useRef } from 'react'; import PropTypes from 'prop-types'; import { styled } from '@mui/material/styles'; import Tabs from '@mui/material/Tabs'; @@ -49,6 +49,7 @@ export function WindowSideBarCanvasPanel({ }) { const { t } = useTranslation(); const containerRef = useRef(); + const tabPanelId = useId(); /** */ const handleSequenceChange = (event) => { @@ -126,15 +127,15 @@ export function WindowSideBarCanvasPanel({ textColor="primary" > {showToc && ( - } /> + } /> )} - } /> - } /> + } /> + } /> )} > -
+
{ collection && (