Skip to content

BBButton: a disabled button can't show its tooltip #125

Open

Description

@germanocaumo

Is your feature request related to a problem? Please describe.
A disabled BBButton can't show its tooltip, which is often when a tooltip is most needed: to say why the button is disabled.

A disabled button gets pointer-events: none and the native disabled attribute, so the Tippy around it never sees a hover, and the button leaves the tab order, so it never sees focus either. In the Storybook, a disabled button with a tooltipLabel shows nothing on hover, and Tab skips it.

The BigBlueButton 4.0 client works around it for two Start buttons that stay disabled until the form is complete:

The wrapper fixes hover only. It isn't focusable, so keyboard and screen-reader users still never get the reason.

BBBCheckbox and BBBToggle solved this in 0.11.0 (#117, #118): with a tooltipLabel, a disabled one stays focusable and is announced through aria-disabled. BBButton doesn't have that yet.

Describe the solution you'd like
The same behaviour for BBButton. When it is disabled and has a tooltipLabel:

  • render aria-disabled="true" instead of the native disabled, so it stays in the tab order and screen readers still announce it as unavailable;
  • keep the disabled look and the not-allowed cursor, without hover or active styles;
  • ignore clicks, including Enter and Space, and don't submit a form when type="submit";
  • show the tooltip on hover and on keyboard focus, and describe the button with it.

A disabled button without a tooltipLabel stays natively disabled, as today.

Describe alternatives you've considered

  • A wrapper in each consumer, as the client does now. It needs markup outside the button, and it still leaves keyboard users out.
  • A wrapper inside BBButton that carries the tooltip. That fixes hover, but a natively disabled button still can't take focus, so it leaves the same keyboard gap.

Affected component(s)
BBButton

Proposed API / Usage Example
No new prop; the existing ones gain the behaviour:

<BBButton
  variant="primary"
  label="Start"
  disabled={!canStart}
  tooltipLabel={canStart ? undefined : 'Pick a response type first'}
  onClick={startPoll}
  fullWidth
/>

Additional context
With this, both Start buttons in the client could drop their wrappers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions