Skip to content

Commit dc99c9a

Browse files
committed
Fixes microsoft/monaco-editor#477: Menu separators should not have a role="button"
1 parent 308709b commit dc99c9a

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/vs/base/browser/ui/actionbar/actionbar.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,15 @@ export class ActionItem extends BaseActionItem {
240240
super.render(container);
241241

242242
this.$e = $('a.action-label').appendTo(this.builder);
243-
if (this.options.isMenu) {
244-
this.$e.attr({ role: 'menuitem' });
243+
if (this._action.id === Separator.ID) {
244+
// A separator is a presentation item
245+
this.$e.attr({ role: 'presentation' });
245246
} else {
246-
this.$e.attr({ role: 'button' });
247+
if (this.options.isMenu) {
248+
this.$e.attr({ role: 'menuitem' });
249+
} else {
250+
this.$e.attr({ role: 'button' });
251+
}
247252
}
248253

249254
if (this.options.label && this.options.keybinding) {
@@ -538,6 +543,7 @@ export class ActionBar extends EventEmitter implements IActionRunner {
538543
}
539544

540545
if (!item) {
546+
console.log(`hello world`);
541547
item = new ActionItem(this.context, action, options);
542548
}
543549

0 commit comments

Comments
 (0)