Announces manual hero slide changes and adds a pause button
Screen readers now hear the new photo after an arrow or swipe, while automatic changes stay silent. A pause button bottom right lets visitors stop the slide show, which hover and keyboard focus alone did not allow on touch screens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { chakra, useRecipe } from '@chakra-ui/react';
|
||||
import { Icon } from '@iconify/react/offline';
|
||||
import caretRightOutlined from '@iconify-icons/ant-design/caret-right-outlined';
|
||||
import pauseOutlined from '@iconify-icons/ant-design/pause-outlined';
|
||||
|
||||
type HeroPauseButtonProps = {
|
||||
stopped: boolean;
|
||||
onToggle: () => void;
|
||||
};
|
||||
|
||||
// Rechtsonder, spiegelbeeld van de socials linksonder. De naam wisselt mee
|
||||
// met de stand (W3C carrouselpatroon), daarom geen aria-pressed.
|
||||
export default function HeroPauseButton({
|
||||
stopped,
|
||||
onToggle,
|
||||
}: HeroPauseButtonProps) {
|
||||
const iconControl = useRecipe({ key: 'iconControl' });
|
||||
|
||||
return (
|
||||
<chakra.button
|
||||
type="button"
|
||||
aria-label={
|
||||
stopped
|
||||
? 'Diavoorstelling afspelen'
|
||||
: 'Diavoorstelling pauzeren'
|
||||
}
|
||||
data-testid="hero-pause-button"
|
||||
onClick={onToggle}
|
||||
css={iconControl()}
|
||||
position="absolute"
|
||||
right="gutter"
|
||||
bottom={{ base: 6, md: 10 }}
|
||||
zIndex={2}
|
||||
fontSize="1.5rem"
|
||||
>
|
||||
<Icon
|
||||
icon={stopped ? caretRightOutlined : pauseOutlined}
|
||||
aria-hidden
|
||||
/>
|
||||
</chakra.button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user