fix: replace outer <button> with <div> in TimelineTrackContent to resolve nested button hydration error

TimelineTrackContent wrapped its entire content in a <button>, while each
timeline element (ElementInner) also rendered its own <button> for click
handling. This created an invalid HTML structure where <button> was nested
inside <button>, triggering a React hydration error:

  "In HTML, <button> cannot be a descendant of <button>."

The outer <button> in TimelineTrackContent only handled click-to-deselect
and mousedown events — it did not need button semantics. Replacing it with
a <div> preserves the exact same event handling behavior while eliminating
the invalid nesting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
KEHUACN 2026-02-13 11:43:08 +08:00
parent fca99d6126
commit 704b418529
1 changed files with 2 additions and 3 deletions

View File

@ -63,7 +63,7 @@ export function TimelineTrackContent({
});
return (
<button
<div
className="size-full"
onClick={(event) => {
if (shouldIgnoreClick?.()) return;
@ -74,7 +74,6 @@ export function TimelineTrackContent({
event.preventDefault();
onTrackMouseDown?.(event);
}}
type="button"
>
<div className="relative h-full min-w-full">
{track.elements.length === 0 ? (
@ -107,6 +106,6 @@ export function TimelineTrackContent({
})
)}
</div>
</button>
</div>
);
}