Element that opens an overlay stays in its variant that should only be active "while pressing"

Hello there, I have a button with three variants:

  • Default
  • Hovering
  • Pressing

Default changes to Hover “while hovering”, Hover changes to Pressing “while pressing”.

However, the button has now to open an overlay “on click”. The problem is, the button then stays in its Pressing variant even after the overlay is closed. I could not find any way to avoid this behavior (e.g. redundantly telling the Pressing variant to change to default on “mouse up”).

Afterward, I tried what happens if I remove the Pressing variant (I removed the “while pressing” interaction, so the button stays in Hovering). To my surprise, after closing the overlay the button changed from Hovering back to Default (as it should), in case I am not hovering it anymore.

So why does the “while hovering” interaction work as intended whereas “while pressing” does not?

5 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.