construct-ui
construct-ui copied to clipboard
Tooltip on button that becomes disabled does not disappear
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
});
});
I'm going to rework the Tooltip
logic, seems like it has quite a few issues I didn't consider.