Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ae3268c

Browse files
committedJan 25, 2023
fix checkbox aria
1 parent a31fedd commit ae3268c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed
 

‎web_src/js/features/aria.js

+12
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,15 @@ function attachOneDropdownAria($dropdown) {
9898
export function attachDropdownAria($dropdowns) {
9999
$dropdowns.each((_, e) => attachOneDropdownAria($(e)));
100100
}
101+
102+
export function attachCheckboxAria($checkboxes) {
103+
$checkboxes.checkbox();
104+
for (const el of $checkboxes) {
105+
const label = el.querySelector('label');
106+
const input = el.querySelector('input');
107+
if (!label || !input || input.getAttribute('id')) continue;
108+
const id = generateAriaId();
109+
input.setAttribute('id', id);
110+
label.setAttribute('for', id);
111+
}
112+
}

‎web_src/js/features/common-global.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {mqBinarySearch} from '../utils.js';
44
import {createDropzone} from './dropzone.js';
55
import {initCompColorPicker} from './comp/ColorPicker.js';
66
import {showGlobalErrorMessage} from '../bootstrap.js';
7-
import {attachDropdownAria} from './aria.js';
7+
import {attachCheckboxAria, attachDropdownAria} from './aria.js';
88
import {handleGlobalEnterQuickSubmit} from './comp/QuickSubmit.js';
99
import {initTooltip} from '../modules/tippy.js';
1010
import {svg} from '../svg.js';
@@ -111,7 +111,7 @@ export function initGlobalCommon() {
111111
});
112112
attachDropdownAria($uiDropdowns);
113113

114-
$('.ui.checkbox').checkbox();
114+
attachCheckboxAria($('.ui.checkbox'));
115115

116116
$('.tabular.menu .item').tab();
117117
$('.tabable.menu .item').tab();

0 commit comments

Comments
 (0)
Please sign in to comment.