I recently encountered odd behavior with the interaction of tooltips and ToggleButtons (or any Button with click toggling enabled). Specifically, when I click on a ToggleButton that is currently in the “off” state, tooltips cease to appear.
After looking through the implementations of juce::Button and juce::TooltipWindow, it seems to be clear what is causing this.
See image A
The global modifiers are likely changed here so that any events triggered by setToggleState() will have the relevant modifiers, such as which mouse button was used to click the Button, even though the mouse was already released at this point. The only issue is that the modifers are never reverted back to their present state. Causing the following block of code to incorrectly be skipped:
See image B
Because this issue is caused by the lack of anything changing the modifiers back to their present state, clicking anywhere will cause the tooltips to appear again.
After changing the modifiers and setting the toggle state, return the modifiers to their correct state
See image C
I can confirm that, after making this change locally, tooltips now appear as expected.
Image reference, to get around the maximum 1 upload requirement for new users: