Repository navigation
Description
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 poll panel's Start, whose tooltip lists what is missing (no type picked, too few options, no correct answer). The client wraps the button and puts its own tooltip on the wrapper;
- the breakout-room creation panel's Start, the same way.
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 nativedisabled, 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
BBButtonthat 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.
Activity
refactor(buttons): size BBButtons with fullWidth and styled(BBButton)
refactor(buttons): size BBButtons with fullWidth and styled(BBButton)