@@ -14,7 +14,10 @@ import {
14
14
ElectronMenuOptions ,
15
15
ElectronMainMenuFactory as TheiaElectronMainMenuFactory ,
16
16
} from '@theia/core/lib/electron-browser/menu/electron-main-menu-factory' ;
17
- import type { MenuDto } from '@theia/core/lib/electron-common/electron-api' ;
17
+ import type {
18
+ MenuDto ,
19
+ MenuRole ,
20
+ } from '@theia/core/lib/electron-common/electron-api' ;
18
21
import { inject , injectable } from '@theia/core/shared/inversify' ;
19
22
import {
20
23
ArduinoMenus ,
@@ -133,6 +136,15 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
133
136
return { label, submenu } ;
134
137
}
135
138
139
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars
140
+ protected override roleFor ( id : string ) : MenuRole | undefined {
141
+ // MenuItem `roles` are completely broken on macOS:
142
+ // - https://github.com/eclipse-theia/theia/issues/11217,
143
+ // - https://github.com/arduino/arduino-ide/issues/969
144
+ // IDE2 uses commands instead.
145
+ return undefined ;
146
+ }
147
+
136
148
protected override fillMenuTemplate (
137
149
parentItems : MenuDto [ ] ,
138
150
menuModel : MenuNode ,
@@ -262,12 +274,12 @@ export class ElectronMainMenuFactory extends TheiaElectronMainMenuFactory {
262
274
execute : ( ) => this . execute ( commandId , args , options . rootMenuPath ) ,
263
275
} ;
264
276
265
- // Do not restrict menu item roles for macOS
266
- // https://github.com/eclipse-theia/theia/issues/12487
267
- const role = this . roleFor ( node . id ) ;
268
- if ( role ) {
269
- menuItem . role = role ;
270
- delete menuItem . execute ;
277
+ if ( isOSX ) {
278
+ const role = this . roleFor ( node . id ) ;
279
+ if ( role ) {
280
+ menuItem . role = role ;
281
+ delete menuItem . execute ;
282
+ }
271
283
}
272
284
parentItems . push ( menuItem ) ;
273
285
0 commit comments