license import { numbers , strings } from './constants' ; const { ARIA_LIVE_DELAY_MS } = numbers ; const { ARIA_LIVE_LABEL_TEXT_ATTR } = strings ; function announce ( ariaEl , labelEl = ariaEl ) { const priority = ariaEl . getAttribute ( 'aria-live' ) ; const labelText = labelEl . textContent ! . trim ( ) ; if ( ! labelText || ! priority ) { return ; } ariaEl . setAttribute ( 'aria-live' , 'off' ) ; labelEl . textContent = '' ; labelEl . innerHTML = '<span style="display: inline-block; width: 0; height: 1px;">&nbsp;</span>' ; labelEl . setAttribute ( ARIA_LIVE_LABEL_TEXT_ATTR , labelText ) ; setTimeout ( ( ) => { ariaEl . setAttribute ( 'aria-live' , priority ) ; labelEl . removeAttribute ( ARIA_LIVE_LABEL_TEXT_ATTR ) ; labelEl . textContent = labelText ; } , ARIA_LIVE_DELAY_MS ) ; } export { announce } ;