(selector: string)
| 6 | import type { |
| 7 | A11yIssue, |
| 8 | RuleSetPreset, |
| 9 | SeverityThreshold, |
| 10 | } from '../types/types' |
| 11 | |
| 12 | export function scrollToElement(selector: string): boolean { |
| 13 | try { |
| 14 | const element = document.querySelector(selector) |
| 15 | if (element) { |
| 16 | element.scrollIntoView({ |
| 17 | behavior: 'smooth', |
| 18 | block: 'start', |
| 19 | inline: 'nearest', |
| 20 | }) |
| 21 | return true |
| 22 | } |
| 23 | } catch (error) { |
| 24 | console.warn('[A11y Panel] Could not scroll to element:', selector, error) |
| 25 | } |
| 26 | return false |