| 188 | } |
| 189 | |
| 190 | function buildFallbackSelection(el: HTMLElement): ResolvedComponent { |
| 191 | const tagName = el.tagName.toLowerCase(); |
| 192 | const dataName = el.getAttribute("data-component-name")?.trim(); |
| 193 | const ariaLabel = el.getAttribute("aria-label")?.trim(); |
| 194 | const textLabel = el.textContent?.trim(); |
| 195 | const componentName = |
| 196 | dataName || |
| 197 | ariaLabel || |
| 198 | (textLabel ? textLabel.slice(0, 24) : "") || |
| 199 | `<${tagName}>`; |
| 200 | |
| 201 | return { |
| 202 | tagName, |
| 203 | componentName, |
| 204 | filePath: "", |
| 205 | lineNumber: 0, |
| 206 | columnNumber: 0, |
| 207 | stack: [], |
| 208 | }; |
| 209 | } |
| 210 | |
| 211 | function getCanonicalSelectableElement(clientX: number, clientY: number): HTMLElement | null { |
| 212 | const pageEl = getPageElementAtPoint(clientX, clientY); |