We take care of many of the difficult implementation details related to accessibility, including aria and role attributes, focus management, and keyboard navigation. That means that users should be able to use our components as-is in most contexts and rely on functionality to follow the expected accessibility designs.
WAI-ARIA (opens in a new tab), published and maintained by the W3C, specifies the semantics for many common UI patterns that show up in Lualtek UI components. This is designed to provide meaning for controls that aren't built using elements provided by the browser. For example, if you use a
div instead of a
button element to create a button, there are attributes you need to add to the div in order to convey that it's a button for screen readers or voice recognition tools, and this is why should use a
button in these situations.
In addition to semantics, there are behaviors that are expected from different types of components. A
button element is going to respond to certain interactions in ways that a
With many built-in form controls, the native HTML
label element is designed to provide semantic meaning and context for corresponding
input elements. For non-form control elements, or for custom controls like those provided by Lualtek UI, WAI-ARIA provides a specification (opens in a new tab) for how to provide accessible names and descriptions to those contols.
Where possible, Lualtek UI components include abstractions to make labelling our controls simple. The
label primitive is designed to work with many of our controls. Ultimately it's up to you to provide those labels so that users have the proper context when navigating your application.
Many complex components, like
Dialog, come with expectations from users on how to interact with their content using a keyboard or other non-mouse input modalities. Lualtek UI components provide basic keyboard support in accordance with the WAI-ARIA authoring practices (opens in a new tab).
Proper keyboard navigation and good labelling often go hand-in-hand with managing focus. When a user interacts with an element and something changes as a result, it's often helpful to move focus with the interaction so that the next tab stop is logical depending on the new context of the app. And for screen reader users, moving focus often results in an announcement to convey this new context, which relies on proper labelling.
In many Lualtek UI components, we move focus based on the interactions a user normally takes in a given component. For example, in
Modal, when the modal is opened, focus is programatically moved to a Cancel button element to anticipate a response to the prompt.