vrimar / construct-ui

A Mithril.js UI library
https://vrimar.github.io/construct-ui
MIT License
287 stars 24 forks source link

Tooltip not displayed on disabled Button #8

Closed angrytongan closed 4 years ago

angrytongan commented 4 years ago

Tooltip is not displayed when hovering over a disabled Button. Not sure if this is desired behaviour or not.

'use strict';

const {
    Button,
    FocusManager,
    Select,
    Tooltip,

} = CUI;
FocusManager.showFocusOnlyOnTab();

const DisabledButtonNoTooltip = () => {
    return {
        view: () => {
            return m('', [
                m(Tooltip, {
                    content: 'No tooltip on disabled button',
                    trigger: m(Button, {
                        label: 'A disabled button',
                        disabled: true,
                    }),
                }),
                m(Tooltip, {
                    content: 'Tooltip on disabled button',
                    trigger: m(Button, {
                        label: 'An enabled button',
                        disabled: false,
                    }),
                }),
            ]);
        },
    };
};
vrimar commented 4 years ago

Yeah, disabled elements in general don't trigger any DOM events. Setting class="cui-disabled" can be used as a work around as seen in this example.

angrytongan commented 4 years ago

No worries. Thanks for the quick response!