mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 10:10:08 +02:00
Merge pull request #22908 from overleaf/mf-fix-disable-element-bs5-anchor-tag
[web] Fix `disableElement` won't properly disable the element if using bs5 and applied on anchor tag GitOrigin-RevId: 49ce8514be3e44e5e3a45f41751c94c77f34399b
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
import { isBootstrap5 } from './bootstrap-5'
|
||||
|
||||
export function disableElement(el) {
|
||||
el.setAttribute('disabled', '')
|
||||
if (isBootstrap5() && el.tagName.toLowerCase() === 'a') {
|
||||
el.classList.add('disabled')
|
||||
} else {
|
||||
el.disabled = true
|
||||
}
|
||||
el.setAttribute('aria-disabled', 'true')
|
||||
}
|
||||
|
||||
export function enableElement(el) {
|
||||
el.removeAttribute('disabled')
|
||||
if (isBootstrap5() && el.tagName.toLowerCase() === 'a') {
|
||||
el.classList.remove('disabled')
|
||||
} else {
|
||||
el.disabled = false
|
||||
}
|
||||
el.removeAttribute('aria-disabled')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user