2024-07-07 17:32:30 +02:00
|
|
|
import {linkLabelAndInput} from './base.ts';
|
2023-03-22 10:52:01 +08:00
|
|
|
|
|
|
|
|
export function initAriaCheckboxPatch() {
|
2024-03-29 05:56:01 +01:00
|
|
|
// link the label and the input element so it's clickable and accessible
|
|
|
|
|
for (const el of document.querySelectorAll('.ui.checkbox')) {
|
|
|
|
|
if (el.hasAttribute('data-checkbox-patched')) continue;
|
|
|
|
|
const label = el.querySelector('label');
|
|
|
|
|
const input = el.querySelector('input');
|
2024-03-31 01:00:58 +01:00
|
|
|
if (!label || !input) continue;
|
2024-04-18 11:01:06 +02:00
|
|
|
linkLabelAndInput(label, input);
|
2024-03-29 05:56:01 +01:00
|
|
|
el.setAttribute('data-checkbox-patched', 'true');
|
2023-03-22 10:52:01 +08:00
|
|
|
}
|
|
|
|
|
}
|