Estimated reading time : 4 min · Published
Describe the outcome in the label
The W3C link and button patterns distinguish destination and action. “View prices” can open a page; “Send enquiry” submits a form. Retain that distinction even when controls look alike.
Use a verb and object where they clarify consequences. Repeated “Learn more” links need identifiable context. Deletion or payment should name what is affected. An icon-only control needs an accessible name consistent with its visible purpose.
Choose waiting and unavailable states
Inside a form, the HTML button element needs an appropriate type: a secondary action should not accidentally submit. Native disabled prevents activation; aria-disabled announces a state but does not block the action itself.
Explain why an important action is unavailable and how to enable it. An unexplained disabled control can leave people searching for an invisible error. During submission, keep a clear waiting state and recovery from failure; do not remove all explanation when activation is blocked.
Fictional case: a form contains “Preview” and “Send”. Set type="button" for preview and type="submit" for submission. In an ordinary form, a button with no type can become a submit button; its colour or label does not change that behaviour. Test each control with a mouse, Enter and Space, then check that preview creates no enquiry.
For an unavailable control, separate the announced state from execution. disabled is a Boolean HTML attribute: disabled="false" still leaves it present and does not enable the button. aria-disabled="true" exposes a state without blocking the action or changing tab order by itself. If this choice is needed, code must also prevent the operation; pointer-events: none does not cover the keyboard. Keep a visible explanation and check server-side conditions for a sensitive action.
Scroll the table horizontally to read every column. With a keyboard, focus the table area and use the arrow keys.
| Test case | Declaration examined | Result to check |
|---|---|---|
| Preview within a form | type="button" | No submission; only the intended preview occurs |
| Submit the form | type="submit" | The intended validation and submission journey runs |
| Enable a native button | disabled="false" | Still disabled: remove the attribute or set the disabled property to false |
| Announce an unavailable action | aria-disabled="true" | Execution is also prevented by keyboard, with a useful explanation |
Prevent repeated operations at the right layer
Blocking a button after a click can reduce repeated activation, but does not protect against another request or browser history. The service needs repetition handling appropriate to the consequence. Use test data and inspect the recorded outcome.
Specify what cancellation cancels: a local edit, pending request or accepted operation. If saving finishes despite closing the window, its outcome must remain findable. Avoid labels implying a guarantee the system cannot deliver.
Example: an enquiry with an attachment
Educational example: Add document opens file selection without submitting; Send enquiry performs submission. After an error, the button becomes usable and fields remain. A second test repeats a test request and checks that one receipt does not mask two created cases.
Choose an overlay suited to an action list rather than a modal confirmation.
Synthetic case: a card offers a small action list. Open it with the keyboard, close it and continue through the page. A popover is not automatically an accessible menu: names, roles and navigation must match its actual content. Consider a modal dialog when a decision must precede all other interaction.
- Opening and closing are predictable and interactions match the announced component type.
- MDN Popover API
HTML and JavaScript API for non-modal overlays that do not automatically disable the background.
Reference documents
- button patterns · Source consulted
- link
- button element
- MDN Popover API · Source consulted
- WHATWG : HTML button · Source consulted
- MDN : aria-disabled · Source consulted
Content updated on
