Validate accessible field labels in development
Introduce development-time validation for the label
prop on form fields to guard against blank values and guide towards the alternative labelling options that are available.
This validation helps ensure that all fields are accessible to screen readers and other assistive technologies.
Standardise disabled
& critical
state across form fields
Improves the consistency of form fields when combining both disabled
and critical
tone, which includes:
critical
bordersmessage
and not reserving space for it unless explicitly providing the reserveMessageSpace
prop.Improve internal form field spacing
Refined the spacing between internal elements of form fields to align with the latest spacing guidelines.
This change impacts the Stack
spacing between label
and description
, the form field itself and the message
slots.
MonthPicker: Reduce space between month and year fields
Reducing the space between month and year fields to improve correlation between the two fields within the greater context of a form.
Hide field borders in dark containers
Reduce visual noise when a form field is displayed in a dark container by hiding the default border. As fields are light on light backgrounds, the border is used to delineate its bounds against the container, which is not relevant in a dark container.
MonthPicker: Reduce space between fields
Reduce the space between the month and year fields.
Add support for caution
tone to form fields
Provide support for applying a caution
tone to form fields.
Specifying this tone
will show the IconCaution
alongside the provided message
.
EXAMPLE USAGE:
<TextField tone="caution" message="Caution message" />
Show description
on form fields when no label
provided
Previously, a FieldLabel
without a label
would return nothing. However, now that form fields can opt for indirect or hidden labels (via aria-label
or aria-labelledby
), the description
should still be shown if provided.
Note: The secondaryLabel
and tertiaryLabel
remain conditional based on the presence of a label
. This is due to their location in the layout being anchored off the label
.
EXAMPLE USAGE:
<FieldLabel description="Description now visible without label" />
Support data attribute boolean values
The data
attribute map now supports boolean values. This provides an improvement for the developer experience, no longer having to convert values to strings explicitly.
EXAMPLE USAGE:
<Component data={{ 'custom-attribute': true, }} /> // => <div data-custom-attribute="true" />
Autosuggest, Dropdown, MonthPicker, PasswordField, TextField, Textarea: Hide placeholder
text when field is disabled
Autosuggest, Checkbox, CheckboxStandalone, Dropdown, MonthPicker, TextField, Textarea, Radio, RadioGroup: Dim the field value and label when field is disabled
Buttons, Fields, TextLinks, Toggle: Use span
for field state overlays instead of div
Produce more valid HTML as div
elements are not as flexible with which elements they can be inside (from a validators perspective).
Display formAccent
outline on form elements when focused
Autosuggest, Dropdown, MonthPicker, PasswordField, Textarea, TextField: Add aria-label & aria-labelledby support
In some cases it may be necessary for a field to be labelled by another element or even not to have a visual label. Instead of providing a label either aria-label or aria-labelledby can be provided.
EXAMPLE USAGE:
// Standard field label <TextField label="My field" /> // Hidden field label <TextField aria-label="My field" /> // Labelled by another element <Heading id="title">Title</Heading> <TextField aria-labelledby="title" />
Add support for data attribute maps on all components.
EXAMPLE USAGE:
<Alert data={{ testId: 'message' }} /> // => <div data-testId="message" />
TextField,Dropdown,PasswordField,MonthPicker,Textarea: Apply aria-describedby to form elements only when needed
Only apply aria-describedby
to form elements when needed, e.g. either a message
, description
, or an explicit aria-describedby
is passed.
MonthPicker: Announce semantic grouping of fields and improved translation support.
When not on a native device, the MonthPicker uses a fieldset
containing two dropdowns. This change ensures that the grouping is announced correctly. From a translations perspective the labels for the dropdowns are no longer a concatenation of the label
and monthLabel
/yearLabel
, supporting translation of the entire phrase.
TextField, PasswordField, Textarea, Autosuggest, Dropdown, MonthPicker: Add decription to aria-describedby
MonthPicker: Support custom month and year labels
To support internationalisation, you can now pass the following props to MonthPicker
:
string
)string
)string[]
)MonthPicker: Fix internal <Hidden screen>
deprecation warning
The MonthPicker
component was mistakenly using <Hidden screen>
to provide labels to screen readers rather than the new HiddenVisually
component. As a result, deprecation warnings were being logged in the console during development.
MonthPicker: Preserve touchable height on iOS
Fix for the native variant of MonthPicker
having a reduced height on iOS when no value is provided.
Drop lodash usage to decrease bundle size.
This directly affects MonthPicker
and any components using the data
prop: