3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
- import { $ , addDisposableListener , append , asCSSUrl , EventType , IModifierKeyStatus , ModifierKeyEmitter , prepend } from 'vs/base/browser/dom' ;
6
+ import { $ , addDisposableListener , append , asCSSUrl , EventType , ModifierKeyEmitter , prepend } from 'vs/base/browser/dom' ;
7
7
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent' ;
8
8
import { ActionViewItem , BaseActionViewItem , SelectActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems' ;
9
9
import { DropdownMenuActionViewItem , IDropdownMenuActionViewItemOptions } from 'vs/base/browser/ui/dropdown/dropdownActionViewItem' ;
@@ -160,8 +160,13 @@ export class MenuEntryActionViewItem extends ActionViewItem {
160
160
}
161
161
162
162
if ( this . _menuItemAction . alt ) {
163
- const updateAltState = ( keyStatus : IModifierKeyStatus ) => {
164
- const wantsAltCommand = ! ! this . _commandAction . alt ?. enabled && ( keyStatus . altKey || ( ( isWindows || isLinux ) && keyStatus . shiftKey ) ) ;
163
+ let mouseOverOnWindowsOrLinux = false ;
164
+
165
+ const updateAltState = ( ) => {
166
+ const wantsAltCommand = ! ! this . _menuItemAction . alt ?. enabled && (
167
+ this . _altKey . keyStatus . altKey
168
+ || ( this . _altKey . keyStatus . shiftKey && mouseOverOnWindowsOrLinux )
169
+ ) ;
165
170
166
171
if ( wantsAltCommand !== this . _wantsAltCommand ) {
167
172
this . _wantsAltCommand = wantsAltCommand ;
@@ -172,7 +177,20 @@ export class MenuEntryActionViewItem extends ActionViewItem {
172
177
} ;
173
178
174
179
this . _register ( this . _altKey . event ( updateAltState ) ) ;
175
- updateAltState ( this . _altKey . keyStatus ) ;
180
+
181
+ if ( isWindows || isLinux ) {
182
+ this . _register ( addDisposableListener ( container , 'mouseleave' , _ => {
183
+ mouseOverOnWindowsOrLinux = false ;
184
+ updateAltState ( ) ;
185
+ } ) ) ;
186
+
187
+ this . _register ( addDisposableListener ( container , 'mouseenter' , _ => {
188
+ mouseOverOnWindowsOrLinux = true ;
189
+ updateAltState ( ) ;
190
+ } ) ) ;
191
+ }
192
+
193
+ updateAltState ( ) ;
176
194
}
177
195
}
178
196
0 commit comments