app-walk
Version:
An intuitive guided walkthrough library with UI highlighting and voice narration for web apps.
20 lines (19 loc) • 643 B
JavaScript
const HIGH_LIGHT = "4px solid red";
export function setHighlight(element, blinkDurationMs = 2000) {
if (!element)
return;
const htmlElement = element.parentNode;
if (!htmlElement)
return;
htmlElement.focus();
const originalBorder = htmlElement.style.border;
let isHighlighted = false;
const blinkInterval = setInterval(() => {
isHighlighted = !isHighlighted;
htmlElement.style.border = isHighlighted ? HIGH_LIGHT : originalBorder;
}, 200);
setTimeout(() => {
clearInterval(blinkInterval);
htmlElement.style.border = originalBorder;
}, blinkDurationMs);
}