Skip to content
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

Annotation anchoring is unreliable when a page contains multiple iframes that are annotation enabled #539

Closed
robertknight opened this issue Sep 11, 2017 · 1 comment

Comments

@robertknight
Copy link
Member

Extracted from #527 (comment)

The way the client handles anchoring when there are multiple iframes in a document with annotation enabled can result in annotations showing up as Orphans in the sidebar even if they did actually anchor successfully.

When multiple frames are connected to the sidebar, the frameSync service tries to trigger loading/anchoring of all annotations in all frames. Yet it assumes that it will get a single sync response from the host page informing it of whether an annotation anchored or not. So, given the context of eg. a page with two frames on it that have different URLs, what can happen is:

  • An annotation is loaded for the URL of the first frame
  • A loadAnnotations message is dispatched to both frames to ask both frames to anchor the annotation, even though it is clearly not going to be found in the second frame
  • The annotation anchors successfully in the first frame but fails to anchor in the second iframe
  • A sync message comes back from the first frame with the $orphan flag set to false
  • A sync message comes back from the second frame with the $orphan flag set to true
  • The client displays the annotation as an orphan, because that message came back last, even though it did in fact anchor in one of the frames

The ordering in which the "sync" messages come back is not deterministic, which is why it happens only sometimes.

@robertknight
Copy link
Member Author

When multiple frames are connected to the sidebar, the frameSync service tries to trigger loading/anchoring of all annotations in all frames.

This was fixed last year as part of an overhaul of how Hypothesis handles being connected to multiple guest frames. FrameSyncService now only sends each annotation to one guest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant