ghosh / microtip

đŸ’¬ Minimal, accessible, ultra lightweight css tooltip library. Just 1kb.
https://microtip.vercel.app/
MIT License
1.38k stars 74 forks source link

How to hide tooltip after a button is pressed? #41

Closed emaillenin closed 4 years ago

emaillenin commented 4 years ago

Not sure if this is a bug or expected behaviour. When we only hover the button, the tooltip disappears after the mouse is moved away. But when the button is clicked and then moved away, the tooltip stays, how can we remove the tooltip after the click?

Reproduced no https://microtip.now.sh/

tooltip-bug-microtip

ghosh commented 4 years ago

Thanks for reporting @emaillenin. This behaviour is only affecting <a /> tags. Seems like the button and other elements are fine.

I am unsure what's causing this. Will investigate.

Muhnad commented 4 years ago

Hey @ghosh & @emaillenin

it's not a bug it the default state for focus elements like button, link(a) etc....

let's talk about CSS states:

  1. hover: when you hover the button the tooltip disappears after the mouse is moved out. its the default state for hover. the action happens while you hovering on it.

  2. focus: when you focus on the button the tooltip will appear until you de-focus the button or focus to another focusable element.

  3. active: when you click on the button you trigger the active state and active state trigger focus state so the tooltip will appear until you de-focus the button.........

try to click on any button on the example and you will see the button is triggered focus state.

Screen Shot 2020-04-29 at 2 14 52 AM
ghosh commented 4 years ago

Thanks for the breakdown @Muhnad, I see your point.

If that’s the case then we should leave the behaviour as is right? No need to make any changes for now?

Muhnad commented 4 years ago

Exactly yeah. We don't need to any changes. It work as expected.

On Mon, May 4, 2020, 8:43 AM Indrashish Ghosh notifications@github.com wrote:

Thanks for the breakdown @Muhnad https://github.com/Muhnad, I see your point.

If that’s the case then we should leave the behaviour as is right? No need to make any changes for now?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ghosh/microtip/issues/41#issuecomment-623287190, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGIXNC7NLZFNROBCHN57LLRPZPXLANCNFSM4LVQ2PZA .