fix(edit): forward ref and editing props through Tag

Tag dropped every prop beyond children/accent/className, so the editing
surface EditableText attaches (ref, contentEditable, key/blur handlers)
never reached the span: tags rendered through as={Tag} — interests,
philosophy keywords, project-detail technologies — showed a pencil but
never became editable (React 19: ref is a plain prop the component must
declare). Tag is now a pass-through; visitor markup is unchanged.
This commit is contained in:
dong.nguyen committed 2026-10-23 09:31:45 +07:00
1 parent fbf75d8ffa
commit 24de125182
1 file changed
+7 -3
+7 -3
View File
@@ -1,12 +1,16 @@
interface TagProps {
interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
children: React.ReactNode
accent?: boolean
className?: string
// EditableText/TagListEditor attach editing props to the element they render
// through (ref, contentEditable, key/blur handlers) — Tag must forward them
// or the element never becomes editable in edit mode (React 19: ref is a prop).
ref?: React.Ref<HTMLSpanElement>
}
export function Tag({ children, accent = false, className = '' }: TagProps) {
export function Tag({ children, accent = false, className = '', ref, ...rest }: TagProps) {
return (
<span className={`tag ${accent ? 'tag-accent' : ''} ${className}`}>
<span ref={ref} className={`tag ${accent ? 'tag-accent' : ''} ${className}`} {...rest}>
{children}
</span>
)