Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 2x 2x 2x 2x 2x 2x 2x 2x 10x 4x 4x 4x 4x 6x 6x 2x 2x | import { listen } from './shared.js'; /** * @param {(activeElement: Element | null) => void} update * @returns {void} */ export function bind_active_element(update) { listen(document, ['focusin', 'focusout'], (event) => { if (event && event.type === 'focusout' && /** @type {FocusEvent} */ (event).relatedTarget) { // The tests still pass if we remove this, because of JSDOM limitations, but it is necessary // to avoid temporarily resetting to `document.body` return; } update(document.activeElement); }); } |