bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
53 stars 6 forks source link

`focusOnHover` not working for submenu #9757

Closed taauntik closed 3 weeks ago

taauntik commented 1 month ago

Forum post

MenuItem.js needs to use its parent menu's focusOnHover when configuring its own submenu.

ghulamghousdev commented 1 month ago

I think need to add this in defaults in changeMenu inside MenuItem.js:

focusOnHover : config.lazyItems.focusOnHover,
ExtAnimal commented 1 month ago

The config is working fine. It just has to be used in the correct place, in the config block of a Menu

ExtAnimal commented 1 month ago

MenuItem.js needs:

    changeMenu(config, existingMenu) {
        const
            me = this,
            { owner } = me,
            { constrainTo, scrollAction, focusOnHover } = owner,
            options = {
                owner    : me,
                defaults : {
                    type      : 'menu',
                    align     : 's0-e0',
                    anchor    : true,
                    autoClose : true,
                    autoShow  : false,
                    cls       : {
                        'b-sub-menu' : 1 // Marks the widget as a submenu
                    },
                    forElement : me.element,
                    owner      : me,
                    ariaLabel  : me.text,
                    constrainTo,
                    scrollAction
                }
            };

        // This covers both Array and Object which are valid items config formats.
        // menu could be { itemRef : { text : 'sub item 1 } }. But if it has
        // child items or html property in it, it's the main config
        if (config && typeof config === 'object' && !('items' in config) && !('widgets' in config) && !('html' in config)) {
            config = {
                lazyItems : config
            };
        }

        // Propagate focusOnHover down the menu hierarchy
        if (owner.isMenu) {
            me.closeParent = focusOnHover;
            options.focusOnHover = focusOnHover;
        }
        return Menu.reconfigure(existingMenu, config, options);
    }