MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / prepareInteractiveControl

Function prepareInteractiveControl

src/ui/taskCardIndicators.ts:20–41  ·  view source on GitHub ↗
(element: HTMLElement)

Source from the content-addressed store, hash-verified

18 * Mark interactive task-card controls so draggable parent cards do not swallow clicks.
19 */
20export function prepareInteractiveControl(element: HTMLElement): void {
21 element.setAttribute("role", "button");
22 element.tabIndex = 0;
23
24 if (element.dataset.tnNoDrag === "true") {
25 element.setAttribute("draggable", "false");
26 return;
27 }
28
29 element.dataset.tnNoDrag = "true";
30 element.setAttribute("draggable", "false");
31 element.addEventListener("mousedown", (e) => {
32 e.preventDefault();
33 e.stopPropagation();
34 });
35 element.addEventListener("keydown", (e) => {
36 if (e.key !== "Enter" && e.key !== " ") return;
37 e.preventDefault();
38 e.stopPropagation();
39 element.click();
40 });
41}
42
43/**
44 * Creates a badge indicator element with icon, tooltip, and optional click handler.

Callers 9

createStatusIndicatorFunction · 0.90
createPriorityIndicatorFunction · 0.90
updatePriorityIndicatorFunction · 0.90
createBadgeIndicatorFunction · 0.70
updateBadgeIndicatorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected