I’m running into an interesting CSS issue on my portfolio site that I haven’t been unable to solve on my own. I’m using the and tags to transition from an image to a caption/button on desktop hover or mobile click. Unfortunately, it works on all browsers except for Safari iOS.
On my iPhone, I’ll click one of the images and it won't respond; but if I hold down on it, I'm then able to select the caption text which is seemingly there but not visible. I don’t experience this issue on any other mobile browsers that I've tried so far.
See the “Projects” section of this page from Safari iOS to attempt to duplicate the bug.
The specific lines of code regarding this issue can be found here (HTML) and here (CSS).
Note that I used the Bulma CSS framework to create the site, and have since tried several manual changes/additions to the CSS for this section in an attempt to resolve the issue. No luck yet. Any ideas?
The issue is the
.overlay
div
inside offigure
. Because it span the entire width and height of the parent, it's blocking clicks (taps) on mobile and preventingfigcaption
from being revealed.One way to fix this without
JavaScript
(the dream) is to addtabindex="0"
on thefigure
element.Adding
tabindex
will allow the element to respond to:focus
, removing the overlay whenfigure
has been touched.