(element: HTMLElement)
| 18 | * Mark interactive task-card controls so draggable parent cards do not swallow clicks. |
| 19 | */ |
| 20 | export 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. |
no outgoing calls
no test coverage detected