kirill-grouchnikov / radiance

Building modern, elegant and fast Swing applications
BSD 3-Clause "New" or "Revised" License
807 stars 89 forks source link

[Component] Disabled buttons maintain their active rollover / pressed state #484

Closed MichaelWDenney closed 1 month ago

MichaelWDenney commented 1 month ago

Version of Radiance (latest release is 8.0-SNAPSHOT)

7.5-SNAPSHOT

Sub-project (Common, Animation, Theming, Component, ...)

Ribbon

Version of Java (current minimum is 9)

21.0.4+7

Version of OS

Windows 11

The issue you're experiencing (expected vs actual, screenshot, stack trace etc)

  1. I have a band with four buttons. These are straight-forward, non-toggle buttons that enable/disable based on state changes triggered by the buttons themselves. Initially two of the four buttons are disabled:

image

  1. Clicking "Command 2" will result in a state change causing "Command 2" itself to disable and both "Command 3" and "Command 4" to enable. So far no issue:

image

  1. Clicking "Command 3" will result in "Command 2" re-enabling and both "Command 3" and "Command 4" disabling. This works, but notice that "Command 2" is now highlighted. My cursor is nowhere near the band in this screen capture and, as I said, these buttons do not toggle. image

  2. Clicking "Command 2" again will result in a return to the state in step 2. above. However, now notice that "Command 3" is highlighted: image

  3. Clicking "Command 4" will result in a return to the state in step 3. including the highlighting of "Command 2". Clicking "Command 2" at this point, will again disable "Command 2" and enable "Command 3" and "Command 4" but now both "Command 3" and "Command 4" are highlighted: image

Note that I can clear this highlighting simply by running the cursor over the buttons. Doing so, however, does not prevent it from happening again the next time the state changes. However, I have seen this behaviour stop at some point, but I have no idea what caused it to stop.

It kind of seems like the band is remembering previously clicked buttons and, when the currently active button is disabled, attempting to make other enabled buttons active. However, "Command 1", possibly because it is always enabled, does not seem to be impacted by this issue.

kirill-grouchnikov commented 1 month ago

This is probably remembering somewhere that the button was active (rollover / pressed) at the time when its action disabled itself. So when another event enables it back, it is shown in that active state.