Skip to content

Commit 7849d2f

Browse files
committed
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.
1 parent 2074e3d commit 7849d2f

7 files changed

Lines changed: 18 additions & 36 deletions

File tree

‎bigbluebutton-html5/imports/ui/components/breakout-room/breakout-room/participant-room/component.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ const ParticipantBreakoutRoom: React.FC<ParticipantBreakoutRoomProps> = ({
279279
{intl.formatMessage(intlMessages.youAreInRoom, { roomName: userRoomName })}
280280
</Styled.InfoText>
281281
<Styled.CardButton
282+
labelOverflow="wrap"
282283
variant="primary"
283284
dataTest={isCurrentlyInRoom ? 'alreadyConnected' : 'joinRoom'}
284285
label={isCurrentlyInRoom
@@ -345,6 +346,7 @@ const ParticipantBreakoutRoom: React.FC<ParticipantBreakoutRoomProps> = ({
345346
</Styled.FreeJoinRoomCount>
346347
</Styled.FreeJoinRoomCardHeader>
347348
<Styled.CardButton
349+
labelOverflow="wrap"
348350
variant={isCurrent ? 'primary' : 'secondary'}
349351
label={(() => {
350352
if (breakout.isUserCurrentlyInRoom) return intl.formatMessage(intlMessages.alreadyConnected);
@@ -366,12 +368,14 @@ const ParticipantBreakoutRoom: React.FC<ParticipantBreakoutRoomProps> = ({
366368
{isInBreakout && (
367369
<Styled.BottomBar>
368370
<Styled.BottomBarButton
371+
labelOverflow="ellipsis"
369372
variant="primary"
370373
label={intl.formatMessage(intlMessages.callModerator)}
371374
onClick={handleCallModerator}
372375
dataTest="callModeratorButton"
373376
/>
374377
<Styled.BottomBarButton
378+
labelOverflow="ellipsis"
375379
variant="secondary"
376380
label={intl.formatMessage(intlMessages.returnToMainSession)}
377381
onClick={handleReturnToMainSession}

‎bigbluebutton-html5/imports/ui/components/breakout-room/breakout-room/running-room/component.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,13 +605,15 @@ const RunningBreakoutRoom: React.FC<RunningBreakoutRoomProps> = ({
605605
)}
606606
<Styled.BottomBar>
607607
<Styled.BottomBarButton
608+
labelOverflow="ellipsis"
608609
variant="secondary"
609610
label={intl.formatMessage(intlMessages.megaphoneLabel)}
610611
tooltipLabel={intl.formatMessage(intlMessages.megaphoneTooltip)}
611612
onClick={() => setMegaphoneOpen(!megaphoneOpen)}
612613
dataTest="megaphoneButton"
613614
/>
614615
<Styled.BottomBarButton
616+
labelOverflow="ellipsis"
615617
variant="primary"
616618
color="danger"
617619
label={intl.formatMessage(intlMessages.finishLabel)}

‎bigbluebutton-html5/imports/ui/components/breakout-room/breakout-room/styles.ts‎

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -36,40 +36,19 @@ const Separator = styled(BaseSeparator)``;
3636

3737
const PanelContent = styled(BasePanelContent)``;
3838

39-
// A bottom bar's button. The pair drops to one per line before the buttons get narrow
40-
// enough to truncate; a label that still doesn't fit ellipsizes. Only for rows: in a
41-
// column the 10rem basis becomes a height. BBButton can't truncate a label yet
42-
// (bigbluebutton/bbb-ui-components-react#106), so this reaches its label span.
39+
// A bottom bar's button, used with labelOverflow="ellipsis". The pair drops to one per
40+
// line before the buttons get narrow enough to truncate. Only for rows: in a column the
41+
// 10rem basis becomes a height.
4342
const BottomBarButton = styled(BBButton)`
4443
flex: 1 1 10rem;
45-
min-width: 0;
46-
max-width: 100%;
47-
48-
& > span {
49-
display: block;
50-
overflow: hidden;
51-
text-overflow: ellipsis;
52-
white-space: nowrap;
53-
min-width: 0;
54-
}
5544
`;
5645

57-
// A room card's button. A card can be as narrow as 7.5rem, so its label wraps instead of
58-
// being cut, hyphenating a word that doesn't fit where the browser can. The button fills
59-
// its card's spare height, so the buttons of one row of cards match. BBButton keeps a
60-
// label on one line (bigbluebutton/bbb-ui-components-react#105), so this reaches its
61-
// label span.
46+
// A room card's button, used with labelOverflow="wrap". A card can be as narrow as
47+
// 7.5rem, so a word that doesn't fit is hyphenated where the browser can. The button
48+
// fills its card's spare height, so the buttons of one row of cards match.
6249
const CardButton = styled(BBButton)`
6350
flex-grow: 1;
64-
min-width: 0;
65-
max-width: 100%;
66-
67-
& > span {
68-
min-width: 0;
69-
white-space: normal;
70-
overflow-wrap: anywhere;
71-
hyphens: auto;
72-
}
51+
hyphens: auto;
7352
`;
7453

7554
const BreakoutActions = styled.div`

‎bigbluebutton-html5/imports/ui/components/poll/components/ResponseArea.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const ResponseArea: React.FC<ResponseAreaProps> = ({
110110
ariaDescribedBy="add-item-button"
111111
variant="subtle"
112112
color="default"
113+
labelOverflow="wrap"
113114
iconStart={<MdAddCircle />}
114115
disabled={optList.length >= MAX_CUSTOM_FIELDS}
115116
onClick={() => handleAddOption()}

‎bigbluebutton-html5/imports/ui/components/poll/styles.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,8 @@ const PollCheckbox = styled.div`
272272
margin-bottom: ${$2xlPadding};
273273
`;
274274

275-
// BBButton never wraps its label; bigbluebutton/bbb-ui-components-react#105.
276275
const AddItemButton = styled(BBButton)`
277276
align-self: center;
278-
white-space: pre-wrap;
279277
${pollButtonText}
280278
`;
281279

‎bigbluebutton-html5/imports/ui/components/request-unmute-modal/component.jsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ const RequestUnmuteComponent = ({
7979
label={intl.formatMessage(intlMessages.confirmButtonLabel)}
8080
dataTest="confirmUnmute"
8181
iconStart={isSmallViewport ? undefined : <Icon iconName="unmute" />}
82+
labelOverflow={isSmallViewport ? 'wrap' : undefined}
8283
onClick={handleConfirm}
8384
variant="primary"
8485
color="default"
@@ -87,6 +88,7 @@ const RequestUnmuteComponent = ({
8788
label={denyLabel}
8889
dataTest="denyUnmute"
8990
iconStart={isSmallViewport ? undefined : <Icon iconName="mute" />}
91+
labelOverflow={isSmallViewport ? 'wrap' : undefined}
9092
onClick={handleDeny}
9193
variant="secondary"
9294
color="danger"

‎bigbluebutton-html5/imports/ui/components/request-unmute-modal/styles.js‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,10 @@ const RequestModalContent = styled.div`
4141
}
4242
`;
4343

44-
// On a phone the pair stacks at full width (the component drops the icons there).
45-
// BBButton never wraps its label; bigbluebutton/bbb-ui-components-react#105.
44+
// On a phone the pair stacks at full width, and the component drops the icons and
45+
// lets the labels wrap there.
4646
const RequestButton = styled(BBButton)`
4747
min-width: ${confirmationButtonMinWidth};
48-
49-
@media ${smallOnly} {
50-
white-space: normal;
51-
}
5248
`;
5349

5450
export default {

0 commit comments

Comments
 (0)