gitea源码

form.ts 526B

1234567891011121314
  1. import {linkLabelAndInput} from './base.ts';
  2. export function initAriaFormFieldPatch() {
  3. // link the label and the input element so it's clickable and accessible
  4. for (const el of document.querySelectorAll('.ui.form .field')) {
  5. if (el.hasAttribute('data-field-patched')) continue;
  6. const label = el.querySelector(':scope > label');
  7. const input = el.querySelector(':scope > input');
  8. if (!label || !input) continue;
  9. linkLabelAndInput(label, input);
  10. el.setAttribute('data-field-patched', 'true');
  11. }
  12. }