textual icon indicating copy to clipboard operation
textual copied to clipboard

Investigate disabled button state

Open willmcgugan opened this issue 3 years ago • 2 comments

Disabled buttons still have a hover state, even with a hack to watch_mouse_hover.

Investigate why this occurs, and fix or implement a better solution.

willmcgugan avatar Sep 18 '22 21:09 willmcgugan

overriding get_pseudo_classes in the Button class seems to work

    def get_pseudo_classes(self) -> Iterable[str]:
        """Pseudo classes for a widget.

        Returns:
            Iterable[str]: Names of the pseudo classes.

        """
        for cls in super().get_pseudo_classes():
            if cls == 'hover' and self.disabled:
                continue
            yield cls

rogerlew avatar Sep 23 '22 22:09 rogerlew

It doesn't seem to be the case anymore @willmcgugan.

Running textual run docs/examples/widgets/button.py --dev and hovering over the buttons - nothing happens.

darrenburns avatar Nov 02 '22 09:11 darrenburns

Ok, assuming fixed. Re-open if it reoccurs.

willmcgugan avatar Nov 07 '22 11:11 willmcgugan

Did we solve your problem?

Glad we could help!

github-actions[bot] avatar Nov 07 '22 11:11 github-actions[bot]