mirror of https://github.com/docusealco/docuseal
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
572 B
19 lines
572 B
export function announceError (message, timeout = 7000) {
|
|
const el = document.createElement('div')
|
|
el.setAttribute('role', 'alert')
|
|
el.setAttribute('aria-live', 'assertive')
|
|
el.className = 'sr-only'
|
|
el.textContent = message
|
|
document.body.append(el)
|
|
setTimeout(() => el.remove(), timeout)
|
|
}
|
|
|
|
export function announcePolite (message, timeout = 5000) {
|
|
const el = document.createElement('div')
|
|
el.setAttribute('aria-live', 'polite')
|
|
el.className = 'sr-only'
|
|
el.textContent = message
|
|
document.body.append(el)
|
|
setTimeout(() => el.remove(), timeout)
|
|
}
|