Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

BBButton: truncate a long label with an ellipsis

Aperta
#106 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Start in the BBButton component and its styles, where the label span is rendered in the default layout and the div in the stacked layout. Read the TruncatingButtonWrapper example in the issue to see which rules the new truncateLabel prop must reproduce. Done means that with truncateLabel the button can shrink and the label truncates with an ellipsis in the default layout, and the full label appears as the tooltip only when no tooltipLabel is set. Confirm the design choice against #105 before writing code.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Is your feature request related to a problem? Please describe.
In a row of equal-width buttons, a long label either overflows or pushes the row wider. The BigBlueButton 4.0 breakout rooms panel handles this by truncating with an ellipsis. Its buttons include Join/Leave room, Call moderator, Megaphone and Finish. To truncate, the client reaches into BBButton's markup through TruncatingButtonWrapper:

const TruncatingButtonWrapper = styled(FullWidthFlexItem)`
  flex: 1 1 10rem;
  min-width: 0;

  > * {
    min-width: 0;
  }

  button span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
`;

className forwarding (0.9.0) moves the button-level rules into styled(BBButton). The ellipsis still has to target the label <span>, which is internal: the stacked layout renders a div there instead.

Truncation also hides part of the label from sighted users. The accessible name stays whole, because aria-labelledby points at the span. But most of those buttons have no tooltipLabel, so a truncated label can't be read in full.

Describe the solution you'd like
A truncateLabel?: boolean prop for the default layout:

  • The button gets min-width: 0, so it can shrink as a flex item.
  • The label gets overflow: hidden; text-overflow: ellipsis; white-space: nowrap.
  • Optionally, when the label is actually truncated (scrollWidth > clientWidth) and no tooltipLabel is set, the full label shows as the tooltip.

This is the other answer to the overflow in #105. One prop could cover both: labelOverflow?: 'nowrap' | 'wrap' | 'ellipsis'.

Describe alternatives you've considered
The wrapper above, which depends on the label being a direct <span> of the <button>.

Affected component(s)
BBButton

Proposed API / Usage Example

const RoomActionButton = styled(BBButton)`
  flex: 1 1 10rem;
`;

<RoomActionButton label={intl.formatMessage(messages.callModerator)} truncateLabel fullWidth onClick={callModerator} />
Lingua principale
TypeScript
Stelle
2
Fork
5
Merge medio
1g 21h
PR unite (30g)
15

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bigbluebutton/bbb-ui-components-react

Tutte le issue di bigbluebutton/bbb-ui-components-react

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.