-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work around Chrome bug causing sidebar to become invisible #523
Conversation
Codecov Report
@@ Coverage Diff @@
## master #523 +/- ##
==========================================
+ Coverage 90.92% 90.93% +0.01%
==========================================
Files 135 136 +1
Lines 5419 5426 +7
Branches 943 945 +2
==========================================
+ Hits 4927 4934 +7
Misses 492 492
Continue to review full report at Codecov.
|
Turns out it's an older Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=638375 |
From the bug report above, it turns out that there is an alternative and probably better way to fix the problem: Make sure that all links in the sidebar disown their opener when clicked (by adding This enables Chrome to use a separate process for the instance of Hypothesis in the newly opened tab, because that Hypothesis instance no longer has synchronous access to the Hypothesis sidebar in the opening tab (via This method might be better because it avoids the potential overheads that the |
@robertknight |
9c6e37a
to
af4838e
Compare
@seanh - Thanks for the feedback, I've revised the PR accordingly. Adding |
Work around a Chrome bug [1] that can cause the sidebar to become invisible if: 1. The sidebar app is loaded from a Chrome extension AND 2. The current tab was opened by clicking a link inside the sidebar app in a different tab. When the issue occurs, the sidebar web app loads and runs normally but is just not visible on screen. This happens due to an internal issue in Chrome which can be avoided adding `rel="noopener"` to all "normal" [2] links in the client that open URLs in a new tab/window. Doing so enables Chrome to use a separate process for the Hypothesis client in the new tab in step (2) than the one used for the Hypothesis client in step (1). This change also prevents potential tab-jacking attacks in all browsers that support `rel="noopener"`. Fixes #516 [1] https://bugs.chromium.org/p/chromium/issues/detail?id=753314 [2] ie. Those which do not use JS to handle the link
af4838e
to
325741f
Compare
Confirmed that I can still reproduce the issue on master and that this branch fixes it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
I also tested that it works for links that are not present on the initial client load (I edited an annotation, adding a direct link to it). Good catch there!
* | ||
* [1] https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types#noopener | ||
* [2] https://mathiasbynens.github.io/rel-noopener/ | ||
* [3] https://bugs.chromium.org/p/chromium/issues/detail?id=753314 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice docstring, which is important for a kind of obscure fix like this
Work around a Chrome bug [1] that can cause the sidebar to become
invisible if:
app in a different tab.
When the issue occurs, the sidebar web app loads and runs normally but
is just not visible on screen. Temporarily hiding and showing the iframe
resolves the problem. At the point when the temporary hide & show
occurs, the iframe is positioned to the right of the viewport, so the
user does not see the visibility change.
Fixes #516
[1] https://bugs.chromium.org/p/chromium/issues/detail?id=753314