BBButton: truncate a long label with an ellipsis
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 notooltipLabelis 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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di bigbluebutton/bbb-ui-components-react
-
BBBToggle: label at the start and the switch at the end of a full-width rowForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
bigbluebutton/bbb-ui-components-react#112 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
bigbluebutton/bbb-ui-components-react#108 ·
I maintainer di solito rispondono entro 1 giorno
-
BBButton: subtle variant with neutral color has an opaque white background, so it renders white on white in dark modeForse di nuovo libera @nisatsama l’ha presa 20 giorni fa e non c’è nessuna pull request aperta. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bigbluebutton/bbb-ui-components-react#100 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
bigbluebutton/bbb-ui-components-react#107 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 45/100
bigbluebutton/bbb-ui-components-react#105 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di bigbluebutton/bbb-ui-components-react
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
juice-shop/juice-shop#3706 ·
I maintainer di solito rispondono entro 1 giorno
-
sbx up from a subfolder silently pushes the whole work treeForse già presa @pdettori l’ha presa oggi. Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
outline/outline#14348 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno