@@ -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 } from '@js/ui/menu' ;
1112import { render } from '@js/ui/widget/utils.ink_ripple' ;
@@ -202,7 +203,7 @@ class MenuBase extends HierarchicalCollectionWidget<Properties> {
202203 const { items } = itemData ;
203204 let $popOutContainer ;
204205
205- if ( items && items . length ) {
206+ if ( items ? .length ) {
206207 const $popOutImage = $ ( '<div>' ) . addClass ( DX_MENU_ITEM_POPOUT_CLASS ) ;
207208 $popOutContainer = $ ( '<span>' ) . addClass ( DX_MENU_ITEM_POPOUT_CONTAINER_CLASS ) . append ( $popOutImage ) ;
208209 }
@@ -312,16 +313,22 @@ class MenuBase extends HierarchicalCollectionWidget<Properties> {
312313 return `.${ DX_MENU_ITEM_WRAPPER_CLASS } ` ;
313314 }
314315
315- _hoverStartHandler ( e ) {
316+ _hoverStartHandler ( e : DxEvent ) : void {
316317 const $itemElement = this . _getItemElementByEventArgs ( e ) ;
317318
318319 if ( ! $itemElement || this . _isItemDisabled ( $itemElement ) ) return ;
319320
320321 e . stopPropagation ( ) ;
321322
322323 if ( this . _getShowSubmenuMode ( ) === 'onHover' ) {
323- clearTimeout ( this . _showSubmenusTimeout ) ;
324- this . _showSubmenusTimeout = setTimeout ( this . _showSubmenu . bind ( this , $itemElement ) , this . _getSubmenuDelay ( 'show' ) ) ;
324+ const submenuDelay = this . _getSubmenuDelay ( 'show' ) ;
325+
326+ if ( submenuDelay === 0 ) {
327+ this . _showSubmenu ( $itemElement ) ;
328+ } else {
329+ clearTimeout ( this . _showSubmenusTimeout ) ;
330+ this . _showSubmenusTimeout = setTimeout ( this . _showSubmenu . bind ( this , $itemElement ) , submenuDelay ) ;
331+ }
325332 }
326333 }
327334
@@ -382,7 +389,7 @@ class MenuBase extends HierarchicalCollectionWidget<Properties> {
382389 }
383390
384391 _hasSubmenu ( node ) {
385- return node && node . internalFields . childrenKeys . length ;
392+ return node ? .internalFields . childrenKeys . length ;
386393 }
387394
388395 _renderContentImpl ( ) {
@@ -459,7 +466,7 @@ class MenuBase extends HierarchicalCollectionWidget<Properties> {
459466
460467 const $node = $nodeElement ?? this . _createDOMElement ( $nodeContainer ) ;
461468
462- if ( items [ index + 1 ] && items [ index + 1 ] . beginGroup ) {
469+ if ( items [ index + 1 ] ? .beginGroup ) {
463470 $node . addClass ( DX_MENU_ITEM_LAST_GROUP_ITEM ) ;
464471 }
465472
0 commit comments