mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 05:00:06 +02:00

[web] Fix `disableElement` won't properly disable the element if using bs5 and applied on anchor tag GitOrigin-RevId: 49ce8514be3e44e5e3a45f41751c94c77f34399b
19 lines
471 B
JavaScript
19 lines
471 B
JavaScript
import { isBootstrap5 } from './bootstrap-5'
|
|
|
|
export function disableElement(el) {
|
|
if (isBootstrap5() && el.tagName.toLowerCase() === 'a') {
|
|
el.classList.add('disabled')
|
|
} else {
|
|
el.disabled = true
|
|
}
|
|
el.setAttribute('aria-disabled', 'true')
|
|
}
|
|
|
|
export function enableElement(el) {
|
|
if (isBootstrap5() && el.tagName.toLowerCase() === 'a') {
|
|
el.classList.remove('disabled')
|
|
} else {
|
|
el.disabled = false
|
|
}
|
|
el.removeAttribute('aria-disabled')
|
|
}
|