construct-ui icon indicating copy to clipboard operation
construct-ui copied to clipboard

Tooltip on button that becomes disabled does not disappear

Open angrytongan opened this issue 4 years ago • 1 comments

Disabling a button with a tooltip shown does not remove the tooltip. Tested with Chrome on Mac OS X.

const {
    Button,
    FocusManager,
    Tooltip,

} = CUI;
FocusManager.showFocusOnlyOnTab();

const TooltipDisablingButton = () => {
    let buttonDisabled = false;

    return {
        view: () => {
            return m(Tooltip, {
                content: 'Tooltip remains after button disabled',
                trigger: m(Button, {
                    label: 'Click to disable',
                    disabled: buttonDisabled,
                    onclick: () => {
                        buttonDisabled = true;
                    },
                })
            });
        },
    };
};

document.addEventListener('DOMContentLoaded', () => {
    m.route(document.body, '/', {
        '/': TooltipDisablingButton
    });
});

angrytongan avatar Jan 31 '20 09:01 angrytongan

I'm going to rework the Tooltip logic, seems like it has quite a few issues I didn't consider.

vrimar avatar Mar 16 '20 23:03 vrimar