@@ -134,20 +134,25 @@ export const Flash = React.forwardRef(
134134 const headerRef = useMergeRefs ( headerRefAction , headerRefContent , headerRefObject ) ;
135135 const contentRef = useMergeRefs ( contentRefAction , contentRefContent , contentRefObject ) ;
136136
137- const iconType = ICON_TYPES [ type ] ;
137+ const statusIconAriaLabel =
138+ props . statusIconAriaLabel ||
139+ i18nStrings ?. [ `${ loading || type === 'in-progress' ? 'inProgress' : type } IconAriaLabel` ] ;
138140
139- const icon = loading ? < InternalSpinner /> : < InternalIcon name = { iconType } /> ;
141+ const iconType = ICON_TYPES [ type ] ;
142+ const icon = loading ? (
143+ < span role = "img" aria-label = { statusIconAriaLabel } >
144+ < InternalSpinner />
145+ </ span >
146+ ) : (
147+ < InternalIcon name = { iconType } ariaLabel = { statusIconAriaLabel } />
148+ ) ;
140149
141150 const effectiveType = loading ? 'info' : type ;
142151
143152 const analyticsAttributes = {
144153 [ DATA_ATTR_ANALYTICS_FLASHBAR ] : effectiveType ,
145154 } ;
146155
147- const statusIconAriaLabel =
148- props . statusIconAriaLabel ||
149- i18nStrings ?. [ `${ loading || type === 'in-progress' ? 'inProgress' : type } IconAriaLabel` ] ;
150-
151156 return (
152157 // We're not using "polite" or "assertive" here, just turning default behavior off.
153158 // eslint-disable-next-line @cloudscape-design/prefer-live-region
@@ -175,13 +180,7 @@ export const Flash = React.forwardRef(
175180 >
176181 < div className = { styles [ 'flash-body' ] } >
177182 < div className = { styles [ 'flash-focus-container' ] } tabIndex = { - 1 } >
178- < div
179- className = { clsx ( styles [ 'flash-icon' ] , styles [ 'flash-text' ] ) }
180- role = "img"
181- aria-label = { statusIconAriaLabel }
182- >
183- { icon }
184- </ div >
183+ < div className = { clsx ( styles [ 'flash-icon' ] , styles [ 'flash-text' ] ) } > { icon } </ div >
185184 < div className = { clsx ( styles [ 'flash-message' ] , styles [ 'flash-text' ] ) } >
186185 < div
187186 className = { clsx (
0 commit comments