@@ -14,6 +14,7 @@ import { ResolvedKeybinding, KeyCode } from 'vs/base/common/keyCodes';
1414import { EventHelper , EventType , removeClass , addClass , append , $ , addDisposableListener , addClasses } from 'vs/base/browser/dom' ;
1515import { IContextMenuDelegate } from 'vs/base/browser/contextmenu' ;
1616import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent' ;
17+ import { Emitter } from 'vs/base/common/event' ;
1718
1819export interface ILabelRenderer {
1920 ( container : HTMLElement ) : IDisposable | null ;
@@ -29,7 +30,10 @@ export class BaseDropdown extends ActionRunner {
2930 private boxContainer ?: HTMLElement ;
3031 private _label ?: HTMLElement ;
3132 private contents ?: HTMLElement ;
33+
3234 private visible : boolean | undefined ;
35+ private _onDidChangeVisibility = new Emitter < boolean > ( ) ;
36+ readonly onDidChangeVisibility = this . _onDidChangeVisibility . event ;
3337
3438 constructor ( container : HTMLElement , options : IBaseDropdownOptions ) {
3539 super ( ) ;
@@ -101,11 +105,17 @@ export class BaseDropdown extends ActionRunner {
101105 }
102106
103107 show ( ) : void {
104- this . visible = true ;
108+ if ( ! this . visible ) {
109+ this . visible = true ;
110+ this . _onDidChangeVisibility . fire ( true ) ;
111+ }
105112 }
106113
107114 hide ( ) : void {
108- this . visible = false ;
115+ if ( this . visible ) {
116+ this . visible = false ;
117+ this . _onDidChangeVisibility . fire ( false ) ;
118+ }
109119 }
110120
111121 isVisible ( ) : boolean {
@@ -303,6 +313,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
303313 this . element . tabIndex = 0 ;
304314 this . element . setAttribute ( 'role' , 'button' ) ;
305315 this . element . setAttribute ( 'aria-haspopup' , 'true' ) ;
316+ this . element . setAttribute ( 'aria-expanded' , 'false' ) ;
306317 this . element . title = this . _action . label || '' ;
307318
308319 return null ;
@@ -321,6 +332,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
321332 }
322333
323334 this . dropdownMenu = this . _register ( new DropdownMenu ( container , options ) ) ;
335+ this . _register ( this . dropdownMenu . onDidChangeVisibility ( visible => this . element ?. setAttribute ( 'aria-expanded' , `${ visible } ` ) ) ) ;
324336
325337 this . dropdownMenu . menuOptions = {
326338 actionViewItemProvider : this . actionViewItemProvider ,
0 commit comments