Accessibility
Keep animated status and controls usable with a keyboard, a screen reader, and reduced motion.
React Dynamic Island provides the visual container. Your application supplies the controls, meaning, focus behavior, and status announcements inside and around it.
Respect reduced motion
The built-in ContentWrapper uses Motion's useReducedMotion hook to remove its blur when the user prefers reduced motion. The outer spring, size changes, fades, and any animations inside your views are not automatically disabled by that hook.
Use the same preference in your component to make size changes immediate and remove the content transition. If you import Motion in application code, install motion as a direct dependency.
"use client";
import { useReducedMotion } from "motion/react";
import DynamicIsland, {
type DynamicIslandProps,
} from "ob-react-dynamic-island";
export function AccessibleIsland<K extends string>(
props: DynamicIslandProps<K>,
) {
const reduceMotion = useReducedMotion();
return (
<DynamicIsland
{...props}
initialAnimatedConfig={
reduceMotion ? undefined : props.initialAnimatedConfig
}
transition={
reduceMotion ? { type: "tween", duration: 0 } : props.transition
}
contentProps={{
...props.contentProps,
...(reduceMotion && {
initial: { opacity: 1, filter: "none", x: 0, y: 0, scale: 1 },
animate: { opacity: 1, filter: "none", x: 0, y: 0, scale: 1 },
exit: {
opacity: 1,
filter: "none",
x: 0,
y: 0,
scale: 1,
transition: { duration: 0 },
},
transition: { duration: 0 },
}),
}}
/>
);
}This wrapper covers the default island animations and the listed content properties. State-level transition and contentProps still take precedence, so apply the same preference to those overrides. Handle any additional transforms, repeating animations, or Motion components inside render as well.
Keep feedback understandable without animation
Show a readable label or a clear static icon for each state. A success message should remain understandable when its checkmark does not draw itself or its container does not expand gradually.
Use real controls
Use buttons for actions and links for navigation. Icon-only actions need an accessible name; decorative icons should be hidden from assistive technology.
<button type="button" aria-label="Pause playback" onClick={pause}>
<PauseIcon aria-hidden="true" />
</button>Keep visible focus styles, provide enough room around each control, and avoid clipping focus outlines with the island's overflow: hidden. Inset focus rings or padding inside the surface can help.
Announce meaningful changes
Place a stable status region outside the changing view when users need confirmation. The text can update with the island's state without being mounted and unmounted by its content transition.
<>
<DynamicIsland value={state} components={components} />
<p role="status" aria-atomic="true">
{state === "saved" ? "Your changes have been saved." : ""}
</p>
</>Use a live region for useful events such as a completed save. Avoid announcing every animation frame, progress tick, or playback time update. Keep equivalent text available for visual indicators such as color changes and battery bars.
Preserve focus during state changes
Changing value replaces the content wrapper. If the focused control is inside the outgoing state, it may be removed from the document. Keep persistent controls outside the changing content when possible, as in the two-state example.
When an action must replace the focused view, manage focus deliberately after the new view mounts. Choose a predictable destination, such as the next relevant control, rather than moving focus for passive status updates.
Check the complete flow
- Operate every action with the keyboard and confirm focus remains visible.
- Verify status text and icon button names with a screen reader.
- Enable reduced motion and check both the surface and the content.
- Check text contrast, zoomed layouts, and small screens.
- Confirm controls still fit in every animated state.