Skip to content

Write HTML. Render video. Built for agents.

docs(examples): stop the sound control from following the card's link

ukimsanov83db94e75e87
diff --git a/docs/snippets/hover-video.jsx b/docs/snippets/hover-video.jsx
index ea41b6d955..7559487b86 100644
--- a/docs/snippets/hover-video.jsx
+++ b/docs/snippets/hover-video.jsx
@@ -105,7 +105,13 @@ export const HoverVideo = ({ src, poster, className, hasAudio = true }) => {
/>
<button
type="button"
- onClick={hasAudio ? toggleSound : togglePlay}
+ onClick={(e) => {
+ // Cards can be wrapped in an <a> (source link) — keep the control's
+ // click (mouse or keyboard) from bubbling up and navigating away.
+ e.preventDefault();
+ e.stopPropagation();
+ (hasAudio ? toggleSound : togglePlay)();
+ }}
aria-pressed={hasAudio ? !muted : playing}
aria-label={
hasAudio