Skip to content

Commit b2107eb

Browse files
Fix CallComposite captions to correctly be <li> items (#5375)
* Fix CallComposite captions to correctly be <li> items nested inside a <ul> * Change files * update width * fix spoken lang rtl
1 parent 8364d25 commit b2107eb

4 files changed

Lines changed: 34 additions & 6 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "",
5+
"comment": "Fix CallComposite captions to correctly be <li> items nested inside a <ul>",
6+
"packageName": "@azure/communication-react",
7+
"email": "2684369+JamesBurnside@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "patch",
3+
"area": "fix",
4+
"workstream": "",
5+
"comment": "Fix CallComposite captions to correctly be <li> items nested inside a <ul>",
6+
"packageName": "@azure/communication-react",
7+
"email": "2684369+JamesBurnside@users.noreply.github.com",
8+
"dependentChangeType": "patch"
9+
}

packages/react-components/src/components/CaptionsBanner.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const _CaptionsBanner = (props: _CaptionsBannerProps): JSX.Element => {
7373
formFactor = 'default',
7474
captionsOptions
7575
} = props;
76-
const captionsScrollDivRef = useRef<HTMLDivElement>(null);
76+
const captionsScrollDivRef = useRef<HTMLUListElement>(null);
7777
const [isAtBottomOfScroll, setIsAtBottomOfScroll] = useState<boolean>(true);
7878
const theme = useTheme();
7979

@@ -113,9 +113,9 @@ export const _CaptionsBanner = (props: _CaptionsBannerProps): JSX.Element => {
113113
return (
114114
<>
115115
{startCaptionsInProgress && (
116-
<FocusZone as="ul" className={captionsContainerClassName} data-ui-id="captions-banner">
116+
<FocusZone className={captionsContainerClassName} data-ui-id="captions-banner">
117117
{isCaptionsOn && (
118-
<div
118+
<ul
119119
ref={captionsScrollDivRef}
120120
className={
121121
captionsOptions?.height === 'full'
@@ -126,12 +126,12 @@ export const _CaptionsBanner = (props: _CaptionsBannerProps): JSX.Element => {
126126
>
127127
{captions.map((caption) => {
128128
return (
129-
<div key={caption.id} className={captionContainerClassName} data-is-focusable={true}>
129+
<li key={caption.id} className={captionContainerClassName} data-is-focusable={true}>
130130
<_Caption {...caption} onRenderAvatar={onRenderAvatar} />
131-
</div>
131+
</li>
132132
);
133133
})}
134-
</div>
134+
</ul>
135135
)}
136136
{!isCaptionsOn && (
137137
<Stack

packages/react-components/src/components/styles/Captions.style.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,23 @@ export const captionsContainerClassName = mergeStyles({
7474
export const captionContainerClassName = mergeStyles({
7575
marginTop: _pxToRem(6),
7676
marginBottom: _pxToRem(6),
77+
textAlign: 'unset', // ensure RTL spoken language captions are appropriately aligned to the right
7778
overflowAnchor: 'auto'
7879
});
7980

81+
/** Reset styling set by the `ul` element */
82+
const resetUlStyling = {
83+
listStyleType: 'none',
84+
padding: 0,
85+
margin: 0
86+
};
87+
8088
/**
8189
* @private
8290
*/
8391
export const captionsBannerClassName = (formFactor: 'default' | 'compact'): string => {
8492
return mergeStyles({
93+
...resetUlStyling,
8594
overflowX: 'hidden',
8695
height: formFactor === 'compact' ? '4.5rem' : '8.75rem',
8796
overflowY: 'auto',
@@ -94,6 +103,7 @@ export const captionsBannerClassName = (formFactor: 'default' | 'compact'): stri
94103
*/
95104
export const captionsBannerFullHeightClassName = (theme: ITheme): string => {
96105
return mergeStyles({
106+
...resetUlStyling,
97107
overflowX: 'hidden',
98108
overflowY: 'auto',
99109
height: '100%',

0 commit comments

Comments
 (0)