|
2 | 2 | // Licensed under the MIT License. |
3 | 3 |
|
4 | 4 | /* @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'; |
6 | 6 | /* @conditional-compile-remove(image-gallery) */ |
7 | 7 | import React, { SyntheticEvent, useState } from 'react'; |
8 | 8 | /* @conditional-compile-remove(image-gallery) */ |
9 | 9 | import { |
10 | 10 | bodyContainer, |
11 | | - bodyFocusZone, |
12 | 11 | brokenImageStyle, |
13 | 12 | cancelIcon, |
14 | 13 | closeButtonStyles, |
@@ -158,35 +157,23 @@ export const ImageGallery = (props: ImageGalleryProps): JSX.Element => { |
158 | 157 | const renderBodyWithLightDismiss = (): JSX.Element => { |
159 | 158 | return ( |
160 | 159 | <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 | + )} |
190 | 177 | </Stack> |
191 | 178 | ); |
192 | 179 | }; |
|
0 commit comments