@@ -29,6 +29,7 @@ import { Icon } from '../../Icon';
2929import { Label } from '../../Label' ;
3030import { Panel } from '../../Panel' ;
3131import { ResponsiveMode , useResponsiveMode } from '../../ResponsiveMode' ;
32+ import { Announced } from '../../Announced' ;
3233import { SelectableOptionMenuItemType , getAllSelectedOptions } from '../../SelectableOption' ;
3334// import and use V7 Checkbox to ensure no breaking changes.
3435import { Checkbox } from '../../Checkbox' ;
@@ -219,6 +220,7 @@ class DropdownInternal extends React.Component<IDropdownInternalProps, IDropdown
219220 private _gotMouseMove : boolean ;
220221 /** Flag for tracking whether focus is triggered by click (alternatively triggered by keyboard nav) */
221222 private _isFocusedByClick : boolean ;
223+ private _wasOpen : boolean ;
222224
223225 constructor ( props : IDropdownInternalProps ) {
224226 super ( props ) ;
@@ -270,6 +272,7 @@ class DropdownInternal extends React.Component<IDropdownInternalProps, IDropdown
270272 this . _hasBeenPositioned = false ;
271273
272274 this . _sizePosCache . updateOptions ( options ) ;
275+ this . _wasOpen = false ;
273276
274277 this . state = {
275278 isOpen : false ,
@@ -298,10 +301,13 @@ class DropdownInternal extends React.Component<IDropdownInternalProps, IDropdown
298301 if ( prevState . isOpen === true && this . state . isOpen === false ) {
299302 this . _gotMouseMove = false ;
300303 this . _hasBeenPositioned = false ;
304+ this . _wasOpen = false ;
301305
302306 if ( this . props . onDismiss ) {
303307 this . props . onDismiss ( ) ;
304308 }
309+ } else if ( prevState . isOpen === false && this . state . isOpen === true ) {
310+ this . _wasOpen = true ;
305311 }
306312 }
307313
@@ -418,6 +424,7 @@ class DropdownInternal extends React.Component<IDropdownInternalProps, IDropdown
418424 } ,
419425 this . _onRenderContainer ,
420426 ) }
427+ { ! isOpen && this . _wasOpen && < Announced message = "collapsed" /> }
421428 { hasErrorMessage && (
422429 < div role = "alert" id = { errorMessageId } className = { this . _classNames . errorMessage } >
423430 { errorMessage }
0 commit comments