What the component guarantees
- A real
<label>withforset to an id the field generates, or tolabel-forwhen you pass one. - That id, handed to you. The default slot receives
id; bind it on your control and the label names it, and clicking the label focuses it. - The hint, linked. With
hint(or the#hintslot), the hint gets an id of its own and the default slot receives it asdescribedby. Bind it asaria-describedbyand the hint is read with the control. When there is no hint,describedbyisundefined, so nothing points at a missing element. - Tested in
tests/Field.test.tsandtests/fieldValidationAria.test.ts, and by axe intests/axe.test.ts.
vue
<NbField label="Display name" hint="Shown on your invoices">
<template #default="{ id, describedby }">
<input :id="id" :aria-describedby="describedby" />
</template>
</NbField>Keyboard
None of its own. NbField is layout; the control inside it takes the keys.
What you own
- Binding
idanddescribedby. A control that ignores the slot props is laid out correctly and announced with no name. Library fields takeidas a prop. - Not doubling labels. If the control inside has its own
label(anNbTextInputwithlabel), leaveNbField's off, or a reader hears two names.
Known gaps
- The label shows a
titletooltip with its own text for truncated labels. It is the only way to see a truncated label in full, which a keyboard user cannot trigger. - No manual screen reader pass has been recorded for this component.