picocss / pico

Minimal CSS Framework for semantic HTML
https://picocss.com
MIT License
13.76k stars 401 forks source link

Tooltips have issues on mobile #184

Closed kvetoslavnovak closed 9 months ago

kvetoslavnovak commented 2 years ago

Describe the issue

  1. Tooltips do not close on mobile.
  2. The inline element tooltip example does not work on mobile at all.

    I believe this may be quite easy to achieve only with css, no javascript needed. E.g. see this classic example https://www.w3schools.com/css/css_tooltip.asp using

    
    .tooltip .tooltiptext {
    visibility: hidden;
    }

.tooltip:hover .tooltiptext { visibility: visible; }



Or solution used in [microtip](https://microtip.vercel.app/) library https://github.com/ghosh/microtip/blob/master/microtip.css which uses opacity property. 

### Current Behavior
The tooltip doesn’t close on mobile. 
The inline element tooltip example does not work on mobile at all.

### Expected Behavior
1. The tooltips should close/disappear on mobile if user touch/click elsewhere. 
2. The inline element tooltip example should work on mobile.

### Reproduction URL
https://picocss.com/docs/tooltips.html

### Environment
Mobile devices (iOS). 
cara-tm commented 2 years ago

Tooltips are often associated to links: how can you display such a kind of web element when on a tap event you are redirected to the target? Maybe Tooltips are not for Mobile screens?

kvetoslavnovak commented 2 years ago

Are you sure? I thought that html standards use the tooltip in connection with the HTML attribute <* title="…"> and hover event.
See Mozilla developer`s wiki for example https://wiki.mozilla.org/Template:Tooltip