@@ -6,6 +6,7 @@ import { asyncNoop, noop } from '@js/core/utils/common';
66import { extend } from '@js/core/utils/extend' ;
77import { each } from '@js/core/utils/iterator' ;
88import { isDefined , isObject , isPlainObject } from '@js/core/utils/type' ;
9+ import type { DxEvent } from '@js/events' ;
910import type { dxMenuBaseOptions } from '@js/ui/context_menu/ui.menu_base' ;
1011import type { Item , SubmenuShowMode } from '@js/ui/menu' ;
1112import { render } from '@js/ui/widget/utils.ink_ripple' ;
@@ -197,7 +198,7 @@ class MenuBase extends HierarchicalCollectionWidget<Properties> {
197198 const { items } = itemData ;
198199 let $popOutContainer ;
199200
200- if ( items && items . length ) {
201+ if ( items ? .length ) {
201202 const $popOutImage = $ ( '<div>' ) . addClass ( DX_MENU_ITEM_POPOUT_CLASS ) ;
202203 $popOutContainer = $ ( '<span>' ) . addClass ( DX_MENU_ITEM_POPOUT_CONTAINER_CLASS ) . append ( $popOutImage ) ;
203204 }
@@ -308,16 +309,22 @@ class MenuBase extends HierarchicalCollectionWidget<Properties> {
308309 return `.${ DX_MENU_ITEM_WRAPPER_CLASS } ` ;
309310 }
310311
311- _hoverStartHandler ( e ) {
312+ _hoverStartHandler ( e : DxEvent ) : void {
312313 const $itemElement = this . _getItemElementByEventArgs ( e ) ;
313314
314315 if ( ! $itemElement || this . _isItemDisabled ( $itemElement ) ) return ;
315316
316317 e . stopPropagation ( ) ;
317318
318319 if ( this . _getShowSubmenuMode ( ) === 'onHover' ) {
319- clearTimeout ( this . _showSubmenusTimeout ) ;
320- this . _showSubmenusTimeout = setTimeout ( this . _showSubmenu . bind ( this , $itemElement ) , this . _getSubmenuDelay ( 'show' ) ) ;
320+ const submenuDelay = this . _getSubmenuDelay ( 'show' ) ;
321+
322+ if ( submenuDelay === 0 ) {
323+ this . _showSubmenu ( $itemElement ) ;
324+ } else {
325+ clearTimeout ( this . _showSubmenusTimeout ) ;
326+ this . _showSubmenusTimeout = setTimeout ( this . _showSubmenu . bind ( this , $itemElement ) , submenuDelay ) ;
327+ }
321328 }
322329 }
323330
@@ -378,7 +385,7 @@ class MenuBase extends HierarchicalCollectionWidget<Properties> {
378385 }
379386
380387 _hasSubmenu ( node ) {
381- return node && node . internalFields . childrenKeys . length ;
388+ return node ? .internalFields . childrenKeys . length ;
382389 }
383390
384391 _renderContentImpl ( ) {
@@ -454,7 +461,7 @@ class MenuBase extends HierarchicalCollectionWidget<Properties> {
454461
455462 const $node = $nodeElement ?? this . _createDOMElement ( $nodeContainer ) ;
456463
457- if ( items [ index + 1 ] && items [ index + 1 ] . beginGroup ) {
464+ if ( items [ index + 1 ] ? .beginGroup ) {
458465 $node . addClass ( DX_MENU_ITEM_LAST_GROUP_ITEM ) ;
459466 }
460467
0 commit comments