fix(edit): keep the tag add button out of the project card link

The project card body is a MotionLink (Projects.tsx, ProjectsListPage.tsx). The chips inside it were safe because they render through EditableText, whose edit-mode onClick does preventDefault + stopPropagation, but the ghost add button was a direct child of the anchor: its click reached the link and the card navigated instead of adding a tag. The add button now stops mousedown and does preventDefault + stopPropagation on click before writing the array - the same guards the item controls and EditableText use. Covers the technologies and the metrics add on both card surfaces.
This commit is contained in:
dong.nguyen committed 2026-10-24 13:37:42 +07:00
1 parent b334348387
commit 8776247176
1 file changed
+10 -1
+10 -1
View File
@@ -126,7 +126,16 @@ export function TagListEditor({
<button
type="button"
className="edit-add-inline"
onClick={() => write([...items, s.edit.newTag])}
// The project card body is a link (Projects.tsx, ProjectsListPage.tsx).
// A click here must not reach that anchor — otherwise adding a tag
// navigates to the project instead. Same guard the item controls use
// (mousedown stopped) plus the click guard EditableText uses.
onMouseDown={(event) => event.stopPropagation()}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
write([...items, s.edit.newTag]);
}}
>
<PlusIcon size={12} />
{addLabel}