mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-23 00:20:40 +07:00
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:
1 parent
b334348387
commit
8776247176
1 file changed
+10
-1
@@ -126,7 +126,16 @@ export function TagListEditor({
|
|||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="edit-add-inline"
|
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} />
|
<PlusIcon size={12} />
|
||||||
{addLabel}
|
{addLabel}
|
||||||
|
|||||||
Reference in new issue
Block a user