Skip to content

Commit 3b193ea

Browse files
[Chat] Remove unnecessary FocusTrapZone for ImageGallery (#3569)
* Remove FocusTrapZone from ImageGallery * Change files * Duplicate change files for beta release * Remove unnecessary imports
1 parent 7d658b5 commit 3b193ea

4 files changed

Lines changed: 36 additions & 42 deletions

File tree

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "none",
3+
"area": "fix",
4+
"workstream": "ImageGallery",
5+
"comment": "Remove FocusTrapZone from ImageGallery",
6+
"packageName": "@azure/communication-react",
7+
"email": "107075081+Leah-Xia-Microsoft@users.noreply.github.com",
8+
"dependentChangeType": "none"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "none",
3+
"area": "fix",
4+
"workstream": "ImageGallery",
5+
"comment": "Remove FocusTrapZone from ImageGallery",
6+
"packageName": "@azure/communication-react",
7+
"email": "107075081+Leah-Xia-Microsoft@users.noreply.github.com",
8+
"dependentChangeType": "none"
9+
}

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

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
// Licensed under the MIT License.
33

44
/* @conditional-compile-remove(image-gallery) */
5-
import { DefaultButton, FocusTrapZone, Icon, IconButton, Modal, Stack, mergeStyles } from '@fluentui/react';
5+
import { DefaultButton, Icon, IconButton, Modal, Stack, mergeStyles } from '@fluentui/react';
66
/* @conditional-compile-remove(image-gallery) */
77
import React, { SyntheticEvent, useState } from 'react';
88
/* @conditional-compile-remove(image-gallery) */
99
import {
1010
bodyContainer,
11-
bodyFocusZone,
1211
brokenImageStyle,
1312
cancelIcon,
1413
closeButtonStyles,
@@ -158,35 +157,23 @@ export const ImageGallery = (props: ImageGalleryProps): JSX.Element => {
158157
const renderBodyWithLightDismiss = (): JSX.Element => {
159158
return (
160159
<Stack className={mergeStyles(bodyContainer)} onClick={() => props.onDismiss()}>
161-
<FocusTrapZone
162-
onKeyDown={(e) => {
163-
if (e.key === 'Escape' || e.key === 'Esc') {
164-
onDismiss();
165-
}
166-
}}
167-
// Ensure when the focus trap has focus, the light dismiss area can still be clicked with mouse to dismiss.
168-
// Note: this still correctly captures keyboard focus, this just allows mouse click outside of the focus trap.
169-
isClickableOutsideFocusTrap={true}
170-
className={mergeStyles(bodyFocusZone)}
171-
>
172-
{images.length > startIndex && (
173-
<img
174-
src={image?.imageUrl}
175-
className={mergeStyles(imageStyle)}
176-
alt={image?.altText || 'image'}
177-
aria-label={'image-gallery-main-image'}
178-
aria-live={'polite'}
179-
onError={(event) => {
180-
setIsImageLoaded(false);
181-
onError && onError(event);
182-
}}
183-
onClick={(event) => event.stopPropagation()}
184-
onDoubleClick={(event) => {
185-
event.persist();
186-
}}
187-
/>
188-
)}
189-
</FocusTrapZone>
160+
{images.length > startIndex && (
161+
<img
162+
src={image?.imageUrl}
163+
className={mergeStyles(imageStyle)}
164+
alt={image?.altText || 'image'}
165+
aria-label={'image-gallery-main-image'}
166+
aria-live={'polite'}
167+
onError={(event) => {
168+
setIsImageLoaded(false);
169+
onError && onError(event);
170+
}}
171+
onClick={(event) => event.stopPropagation()}
172+
onDoubleClick={(event) => {
173+
event.persist();
174+
}}
175+
/>
176+
)}
190177
</Stack>
191178
);
192179
};

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,6 @@ export const bodyContainer: IStyle = {
132132
}
133133
};
134134

135-
/**
136-
* @private
137-
*/
138-
export const bodyFocusZone: IStyle = {
139-
width: '100%',
140-
height: '100%',
141-
display: 'flex',
142-
alignItems: 'center',
143-
justifyContent: 'center'
144-
};
145-
146135
/**
147136
* @private
148137
*/

0 commit comments

Comments
 (0)