diff --git a/contribute/style-guides/accessibility.md b/contribute/style-guides/accessibility.md index f7d5a72e2ac..6d783ae4e40 100644 --- a/contribute/style-guides/accessibility.md +++ b/contribute/style-guides/accessibility.md @@ -17,21 +17,27 @@ The form components from `grafana/ui` provide an easier way to achieve that. The For example: ```tsx - - - +const id = useId(); // React's useId provides a stable globally unique identifier + +return ( + + + +); ``` In the previous example, the code is rendered as: ```html
- - + +
``` -As long as the form element has a unique `id` attribute specified, it's automatically accessible when rendered. +As long as the form element has a globally unique `id` attribute specified and is the direct child element of Field, it's automatically accessible when rendered. + +Make sure you test that each field can be selected by clicking its label! ### Write tests with accessibility in mind