Skip to content

Commit

Permalink
Fix "done"/"saved" statuses to not block clicks when they disappear.
Browse files Browse the repository at this point in the history
Also actually hide them on IE8,9.
(part of collateral damage I inflicted dealing with #56)

Tested on Chrome and Firefox, will test more before deploying.
This really could use automated testing, but it's rather tricky :-(

http://stackoverflow.com/a/10352525/239657 and
http://www.taccgl.org/blog/css-transition-visibility.html
have good explanations why `visibility` transition does the right thing.

I discovered that I had to set `#status_container{ visibility: hidden }`
or it wouldn't work on Chrome; this also avoids #status_container
from blocking clicks, so reverting the less elegant `height: 0`.

I wasn't sure if I should also set `pointer-events: none`.  It makes sure
you can click through the status even when it's visible, but I'm not sure
that's a feature, it doesn't work on IE<11, and would mysteriously prevent
adding a hover tooltip to statuses.
  • Loading branch information
cben committed May 25, 2015
1 parent dc82eab commit dcac759
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions mathdown.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,27 @@

/* Horizontally center http://stackoverflow.com/a/10352525/239657 */
#status_container {
position: fixed; top: 1ex; left: 0; right: 0; height: 0;
position: fixed; top: 1ex; left: 0; right: 0;
text-align: center;
visibility: hidden; /* allow clicking through */
}
#status {
display: inline-block;
padding: 0 0.5em; border-radius: 1ex;
color: black; background-color: yellow;
font-size: 150%; font-style: italic;
opacity: 0;
-webkit-transition: opacity 0.3s ease;
transition: opacity 0.3s ease; /* fast fade out */
/* Without a class, hide the status.
Make sure stuff underneath is clickable (see http://stackoverflow.com/a/21335440/239657). */
opacity: 0; visibility: hidden;
-webkit-transition: all 0.3s ease;
transition: all 0.3s ease; /* fast fade out */
}
#status.info {
/* Explanation for http://cubic-bezier.com/#0,.3,.85,0 curve:
quickly appear a tiny bit (10% at 5% time), then fade in slowly (50% at 80% time). */
opacity: 0.8;
-webkit-transition: opacity 2s cubic-bezier(0,.3,.85,0);
transition: opacity 2s cubic-bezier(0,.3,.85,0); /* slow appear */
opacity: 0.8; visibility: visible;
-webkit-transition: all 2s cubic-bezier(0,.3,.85,0);
transition: all 2s cubic-bezier(0,.3,.85,0); /* slow appear */
}

@media print { #header { display: none; } }
Expand Down

1 comment on commit dcac759

@cben
Copy link
Owner Author

@cben cben commented on dcac759 May 25, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Manually tested via Saucelabs on IE8,9,11, Safari, and to some degree iOS & Android.
Looks good.

Please sign in to comment.