Repository navigation
Description
Is your feature request related to a problem? Please describe.
BBButton has no selected/pressed state, so a group of toggle buttons, where one option is picked, has to be painted by the consumer.
The BigBlueButton 4.0 poll panel's response-type picker is such a group: True/False, A/B/C/D, Yes/No/Abstention and User response. Its spec asks for a grey box when not selected and the dark brand blue with white text once picked, holding that fill through hover and press. To get there, the client:
- switches the variant (
primarywhen selected,tertiaryotherwise), then repaints both states from a wrapper with eight!importantdeclarations. They're needed because the library's hover rule,&&:hover:not(:has(> [data-is-aux-icon]:hover)), outranks any ordinary override. - paints the label separately, because the library sets the color on
& span, which beats a color inherited from the button.
The selected state also isn't exposed to assistive technology. BBButton has no aria-pressed and doesn't pass extra props through, so a screen reader hears four plain buttons and no selection.
More groups like this are coming as the client moves to BBButton:
- the poll/quiz tab selector, a custom
SegmentedButtonthat setsaria-presseditself; - the timer panel's Stopwatch/Timer switch, which still uses the legacy button.
Describe the solution you'd like
A pressed?: boolean prop:
- When set (
trueorfalse): the button rendersaria-pressed={pressed}. Leaving itundefinedmeans "not a toggle", as today. - Pressed style: each variant/color gets a pressed style that holds through hover, active and focus. The design team would define the colors; the poll spec above is one data point.
Describe alternatives you've considered
- Forwarding
aria-pressed(or ARIA props in general). It fixes the accessibility gap, but the style still needs!important. - A segmented-control or toggle-group component. For a group where exactly one option is selected,
role="radiogroup"with radio items may be more accurate thanaria-pressed, and it brings arrow-key navigation. It's a bigger addition. Apressedprop would still cover standalone toggles, such as mute or pin buttons.
Affected component(s)
BBButton
Proposed API / Usage Example
{responseTypes.map((t) => (
<BBButton
key={t.id}
label={t.label}
variant="secondary"
pressed={type === t.id}
onClick={() => setType(t.id)}
fullWidth
/>
))}
Activity
refactor(buttons): size BBButtons with fullWidth and styled(BBButton)
refactor(buttons): size BBButtons with fullWidth and styled(BBButton)
refactor(buttons): size BBButtons with fullWidth and styled(BBButton)
refactor(buttons): size BBButtons with fullWidth and styled(BBButton)
refactor(buttons): size BBButtons with fullWidth and styled(BBButton)
refactor(buttons): size BBButtons with fullWidth and styled(BBButton)
refactor(html5): replace BBButton wrappers with library props, bump b…