Skip to content

feat(BBButton): add labelOverflow prop - #120

Merged
Arthurk12 merged 2 commits into
bigbluebutton:developfrom
Arthurk12:issue/106
Nov 16, 2026
Merged

Arthurk12 merged 2 commits into
bigbluebutton:developfrom
Arthurk12:issue/106

Conversation

@Arthurk12

Copy link
Copy Markdown
Member

What does this PR do?

Adds a labelOverflow prop to BBButton's default layout. It sets what happens when the label doesn't fit the button's available width.

  • labelOverflow="nowrap" (default): keeps today's behavior. The label stays on one line, and the button grows or the label overflows. Existing buttons don't change.
  • labelOverflow="wrap": the label breaks onto more lines, making the button taller.
  • labelOverflow="ellipsis": the label is truncated with an ellipsis, and the button can shrink as a flex item. While the label is truncated and no tooltipLabel is set, the full label shows in a tooltip.
  • Storybook: a new Default story renders a single button driven by the controls, so the Docs page's top preview now responds to them. A new Label Overflow story compares the three values.
  • README: new "Long Labels" section and Props table row.

Closes Issue(s)

Closes #105
Closes #106

Motivation

In a narrow container or a row of equal-width buttons, such as the BigBlueButton 4.0 breakout rooms panel, a long or translated label overflows the button or pushes the row wider. Consumers work around this today by overriding styles on BBButton's internal markup.

@germanocaumo germanocaumo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested base vs head in Chromium, Firefox and WebKit. ellipsis works in a flex row, a block container and with fullWidth. The tooltip shows only while the label is truncated, and the button keeps focus as that changes. Two one-line fixes inline.

#119 changes the same <Tippy>. Whichever PR merges second should keep plugins={TOOLTIP_PLUGINS} there, so the truncated-label tooltip also closes with Escape.

Comment thread src/components/Button/styles.ts Resolved
Comment thread src/components/Button/component.tsx Resolved

@germanocaumo germanocaumo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verified and working

BBButton's default layout always keeps its label on one line
(`white-space: nowrap`). When the button can't grow, for example a
`fullWidth` button in a narrow popover or a row of equal-width buttons,
a long label overflows the button or pushes the row wider. Consumers
work around it by reaching into BBButton's markup: `white-space:
normal` overrides to let the label wrap, or rules on the internal label
<span> to truncate it with an ellipsis, which is not part of the public
API.

Add a `labelOverflow` prop to the default layout, setting what happens
when the label doesn't fit the button's available width:

- `nowrap` (default) keeps today's behavior, so no existing button
  changes.
- `wrap` sets `white-space: normal` and `overflow-wrap: anywhere`, so
  the label breaks onto more lines and a single word too long for the
  button breaks instead of overflowing. `break-word` is not enough: it
  doesn't lower the button's min-content width, so a long word still
  widens the button past its container.
- `ellipsis` gives the button `min-width: 0` and `max-width: 100%`, so
  it can shrink as a flex item and stay within its container, and
  truncates the label with an ellipsis.

Truncation hides part of the label from sighted users, and most such
buttons have no `tooltipLabel`. While the label is actually truncated,
detected with a ResizeObserver comparing scrollWidth and clientWidth,
and no `tooltipLabel` is set, the full label shows as a tooltip on
hover and focus. A single Tippy is kept mounted and toggled through
`disabled`, so the button is not remounted (losing focus) when the
truncation state changes. That tooltip sets `aria.content` to null,
because the label is already the accessible name via aria-labelledby
and would otherwise be announced again as a description. `aria` is
passed on every render, since Tippy keeps the previous value when the
prop is omitted.

Separate `wrapLabel` and `truncateLabel` booleans were considered and
discarded: they can be combined into a contradictory state, and a name
describing the action doesn't say it only applies when the label
doesn't fit. Wrapping by default was also considered; it would make
buttons that overflow today taller, so it is left out of this change.
The first story in a file is the one Storybook shows in the Docs page's
top preview and binds to its Controls table. For BBButton that story
is Primary, which renders three buttons with fixed labels, one per
color. The preview shows three buttons instead of one, and the fixed
labels override the `label` control, so editing it has no visible
effect.

Add a Default story, rendering a single button from the story args,
as the first export. Every other component in the library already
starts with a Default story. Primary and the other variant stories
keep their fixed labels, since they exist to compare colors and sizes
side by side.
@Arthurk12
Arthurk12 merged commit 8500ba1 into bigbluebutton:develop Nov 16, 2026
2 checks passed
@Arthurk12
Arthurk12 deleted the issue/106 branch November 16, 2026 13:43
germanocaumo added a commit to germanocaumo/bigbluebutton that referenced this pull request Nov 16, 2026
0.11.0 adds BBButton's labelOverflow prop
(bigbluebutton/bbb-ui-components-react#120) and shows BBBCheckbox's
checked box in the brand color
(bigbluebutton/bbb-ui-components-react#121). The next commit uses
labelOverflow.

Visible changes, all from the library:
- the camera settings' "Whole image" checkbox is brand blue when
  checked, shows a focus outline, and dims its label while disabled;
- the poll panel's toggles show a focus outline, and "Allow multiple
  answers per respondent?" is dimmed while it is disabled (typed
  responses);
- a tooltip closes on Escape.

The dependencies and peer dependencies are unchanged, and so are the
other components the client uses (BBBSelect, BBBTextInput,
BBBTextAreaInput, BBBModal and BBBHint).
germanocaumo added a commit to germanocaumo/bigbluebutton that referenced this pull request Nov 18, 2026
0.11.0 adds BBButton's labelOverflow prop
(bigbluebutton/bbb-ui-components-react#120) and shows BBBCheckbox's
checked box in the brand color
(bigbluebutton/bbb-ui-components-react#121). The next commit uses
labelOverflow.

Visible changes, all from the library:
- the camera settings' "Whole image" checkbox is brand blue when
  checked, shows a focus outline, and dims its label while disabled;
- the poll panel's toggles show a focus outline, and "Allow multiple
  answers per respondent?" is dimmed while it is disabled (typed
  responses);
- a tooltip closes on Escape.

The dependencies and peer dependencies are unchanged, and so are the
other components the client uses (BBBSelect, BBBTextInput,
BBBTextAreaInput, BBBModal and BBBHint).
germanocaumo added a commit to germanocaumo/bigbluebutton that referenced this pull request Nov 23, 2026
0.11.0 adds BBButton's labelOverflow prop
(bigbluebutton/bbb-ui-components-react#120) and shows BBBCheckbox's
checked box in the brand color
(bigbluebutton/bbb-ui-components-react#121). The next commit uses
labelOverflow.

Visible changes, all from the library:
- the camera settings' "Whole image" checkbox is brand blue when
  checked, shows a focus outline, and dims its label while disabled;
- the poll panel's toggles show a focus outline, and "Allow multiple
  answers per respondent?" is dimmed while it is disabled (typed
  responses);
- a tooltip closes on Escape.

The dependencies and peer dependencies are unchanged, and so are the
other components the client uses (BBBSelect, BBBTextInput,
BBBTextAreaInput, BBBModal and BBBHint).
antobinary pushed a commit to bigbluebutton/bigbluebutton that referenced this pull request Nov 23, 2026
…bb-ui-components-react to 0.11.0 and drop @mui/system (#26048)

* fix(breakout): keep the room cards' join buttons at their normal height

Since the breakout panels moved to the shared TruncatingButtonWrapper
(701d27a), its `flex: 1 1 10rem` also applies inside the participant
panel's column cards: the "You are in room N" card and each free-join
room card. In a column the 10rem basis is a height, so the Join room and
Ask to join buttons render 140px tall instead of at a normal button
height.

Replace the wrapper with styled(BBButton), now that BBButton forwards
className (bbb-ui-components-react 0.9.0). Both buttons still reach the
label span, since BBButton keeps a label on one line and can't truncate
it yet (bigbluebutton/bbb-ui-components-react#105, #106):

- BottomBarButton, for the bottom-bar rows: the 10rem basis, and a label
  that still doesn't fit ellipsizes. The bottom bars keep the same
  layout.
- CardButton, for the room cards: the label wraps instead of being cut,
  hyphenating a word that doesn't fit where the browser can, so a
  narrow free-join card no longer shows "Ask to j...". The button fills
  its card's spare height, so the buttons of one row of cards stay the
  same height.

The breakout join test now checks that the room card's Join room button
keeps a normal button height.

* refactor(buttons): size BBButtons with fullWidth and styled(BBButton)

bbb-ui-components-react 0.9.0 adds BBButton's fullWidth prop and
forwards className. That makes the remaining wrappers that reach into
BBButton's markup (`> *`, `& > button`, `button { ... }`) unnecessary:

- Timer: the action buttons share their row with `flex: 1` on
  styled(BBButton).
- Poll:
  - The delete-option, add-option and live-result buttons are
    styled(BBButton).
  - Cancel and Start share a two-column grid. A flex basis of 0 would
    count Cancel's padding, which Start's bare wrapper doesn't have.
- Breakout creation and poll Start: the buttons use fullWidth. Their
  wrappers stay as the anchors for the tooltip explaining a disabled
  Start (a disabled BBButton ignores pointer events,
  bigbluebutton/bbb-ui-components-react#125), and no longer size the
  button.
- Breakout join dialog: the close button is sized with styled(BBButton)
  instead of `!important`.
- Request unmute: the confirmation min-width and the label wrapping on
  phones move onto styled(BBButton). The icons are dropped through
  iconStart instead of being hidden with CSS.

common/button-wrapper is no longer used, so it goes away.

The response-type picker keeps its wrapper until BBButton has a pressed
state (bigbluebutton/bbb-ui-components-react#107). The labels that set
white-space keep doing so until it can wrap them (#105).

* refactor(video-preview): use BBBCheckbox and drop @mui/system

The camera settings' "Whole image" brightness option was the last user
of common/checkbox, and common/radio has no users. They were also the
only code importing @mui/system directly, which kept a 5.x copy at the
top level next to the 6.x one @mui/material uses.

- The option is a BBBCheckbox. Its label names the input, and its
  description stays linked through aria-describedby.
- common/checkbox and common/radio are removed.
- @mui/system is dropped from package.json, so only MUI 6.x remains.

Visible differences, both from the library's look:
- the checked box is blue instead of green. It is MUI's default blue,
  not the brand color, until the client moves to a library release
  with bigbluebutton/bbb-ui-components-react#121;
- the box loses MUI's 9px ripple padding (39px to 21px). The label stays
  clickable.

The old checkbox also toggled on Enter. Like a native checkbox, it now
toggles on Space.

* build(html5): bump bbb-ui-components-react to 0.11.0

0.11.0 adds BBButton's labelOverflow prop
(bigbluebutton/bbb-ui-components-react#120) and shows BBBCheckbox's
checked box in the brand color
(bigbluebutton/bbb-ui-components-react#121). The next commit uses
labelOverflow.

Visible changes, all from the library:
- the camera settings' "Whole image" checkbox is brand blue when
  checked, shows a focus outline, and dims its label while disabled;
- the poll panel's toggles show a focus outline, and "Allow multiple
  answers per respondent?" is dimmed while it is disabled (typed
  responses);
- a tooltip closes on Escape.

The dependencies and peer dependencies are unchanged, and so are the
other components the client uses (BBBSelect, BBBTextInput,
BBBTextAreaInput, BBBModal and BBBHint).

* refactor(buttons): wrap and truncate BBButton labels with labelOverflow

bbb-ui-components-react 0.11.0 lets BBButton wrap or truncate its label
(labelOverflow), so the client no longer reaches into the button's
label span or sets white-space on it:

- breakout: the room cards' buttons use labelOverflow="wrap" and the
  bottom-bar buttons labelOverflow="ellipsis". CardButton keeps only
  flex-grow and hyphens, BottomBarButton only its 10rem basis. A
  truncated bottom-bar label now shows the full text in a tooltip.
- request-unmute: on a phone the buttons wrap through labelOverflow
  instead of a media query.
- poll: Add item wraps through labelOverflow instead of
  white-space: pre-wrap.

The layouts are otherwise unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants