Assistive technology does not read the legend for fieldsets, so users will not know the label or description for the group as a whole. Currently, the Label componet outputs a div that contains either a <label> or <legend> element, and the legend is not read by a screen reader when entering a fieldset via keyboard.
The Label element wraps the legend or label element in a div. This is necessary for the label, which does not contain the description text (it appears below the label in a separate element). However, for the legend, the description is included in the legend element, and this should be the root element output by Label.
Acceptance criteria
- Label is refactored so that, when isLegend is true, the <legend> element is the root element of the component. The output for a label when isLegend is false should not change.
- legend is read by a screen reader when entering a fieldset