Skip to content

Title: [Button]: add loading state #791

Open

Description

@ceisipeik

Problem

ButtonComponent ([tedi-button]) has no loading state. A button that starts a request, for example "Load more" below a list, has to block repeated clicks while the request runs. The only built-in way is disabled, which removes the button from the tab order: keyboard focus falls to <body> and a screen-reader user loses their place (WCAG 2.4.3).

aria-disabled="true" keeps the focus, but TEDI does not style it. .tedi-button:disabled is the only disabled rule, so an aria-disabled button keeps its normal and hover colours, and each app imitates the disabled look with its own CSS.

The React library already has this: Button takes isLoading, which sets aria-disabled and aria-busy, shows a spinner, and ignores clicks while the button stays focusable (TEDI-Design-System/react#763).

Solution

Add a loading input to ButtonComponent, matching React's isLoading:

  • sets aria-disabled="true" and aria-busy="true" on the host;
  • applies the disabled colours (--button-main-disabled-*) and cursor: not-allowed, without hover and active styles;
  • keeps the button focusable, with the visible focus outline;
  • a click while loading does not reach the consumer's (click) handler, or the documentation states that the consumer ignores it.

Project

SFOS

DoD

  • The component is developed using best practices, conventions, and modern frontend trends
  • The component follows BEM naming conventions (if applicable)
  • The component implementation matches the Figma design, including all defined states and interactions
  • The component supports responsiveness and scales across breakpoints (if applicable)
  • The component does not introduce runtime errors or warnings
  • Linter passes
  • The component is exported from its tier barrel
  • The component has unit tests with at least 80% code coverage (enforced by the global Jest coverageThreshold over tedi/components, not per component)
  • CodeCov passes its threshold (80% on the changed code, with 10% tolerance — a separate gate from the Jest one above)
  • The component has passed code review
  • The component has passed Chromatic visual review
  • Storybook stories are created:
    • Cover all Figma variations
    • Include edge cases, empty/error states
  • Component’s API (props, slots, events) is documented
  • ZeroHeight is updated with design/development guidelines
  • External dependencies used in the component are documented in Storybook and Zeroheight, with rationale
  • Semantic commit format type(scope): Subject text #issue-ref is used (for semantic-release), with the issue reference required - see Commit convention
  • External libraries comply with validated open source licenses
  • Component is versioned correctly and ready for release if required
  • Update the Angular development status on the statuses page in Zeroheight
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tedi-readyTEDI-Ready component issue

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions