fix(a11y): associate labels to inputs in CardEditModal via for/id

Each label now has a for attribute pointing to a unique generated id on
the corresponding input or textarea, satisfying WCAG 1.3.1.

https://claude.ai/code/session_012cK5rUGQvqkuxUZ59x7dLn
This commit is contained in:
Claude 2026-04-29 08:06:03 +00:00
parent f9c5ca0781
commit 7045d82eae
No known key found for this signature in database

View file

@ -82,17 +82,19 @@ export class CardEditModal extends Modal {
}
createLabeledInput(parent: HTMLElement, label: string, value: string) {
const id = `pr-modal-${Math.random().toString(36).slice(2)}`;
const wrapper = parent.createDiv({ cls: 'parallel-reader-modal-field' });
wrapper.createEl('label', { text: label });
const input = wrapper.createEl('input', { attr: { type: 'text' } });
wrapper.createEl('label', { text: label, attr: { for: id } });
const input = wrapper.createEl('input', { attr: { type: 'text', id } });
input.value = value;
return input;
}
createLabeledTextarea(parent: HTMLElement, label: string, value: string, rows: number) {
const id = `pr-modal-${Math.random().toString(36).slice(2)}`;
const wrapper = parent.createDiv({ cls: 'parallel-reader-modal-field' });
wrapper.createEl('label', { text: label });
const textarea = wrapper.createEl('textarea');
wrapper.createEl('label', { text: label, attr: { for: id } });
const textarea = wrapper.createEl('textarea', { attr: { id } });
textarea.rows = rows;
textarea.value = value;
return textarea;