-
Notifications
You must be signed in to change notification settings - Fork 56
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
Gracefully handle documents that are not fully active #90
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
307cc59
Gracefully handle documents that are not fully active
marcoscaceres f9a9ca7
tidy
marcoscaceres 84217ba
fixup
marcoscaceres f2412e5
Merge branch 'gh-pages' into fully-active
marcoscaceres f38c680
Gracefully handle documents that are not fully active
marcoscaceres be3c046
Integrate better with visibility
marcoscaceres 2c4dba6
Integrate better with visibility
marcoscaceres e07e3bf
fixup
marcoscaceres File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Do we want to remember that it happened (not the exact position, but just that we dropped an update) so that we can send an update with the current position when the document becomes fully active and visible again? Otherwise when a page is restored from bfcache and the user stopped moving (?) it might be stuck with a stale location.
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.
In w3ctag/design-principles#317 the example explicitly calls out the Geolocation API as a case where updates should not be queued and delivered once the document becomes fully active. It is however important to note that a site which has called
watchPosition()
expects geolocation updates when there is a significant change in position. To do otherwise will likely cause the site to appear stale when it is restored from bfcache and result in a poor user experience. Therefore, while updates SHOULD NOT be queued so that the site can observe the history of location changes while it was not fully active a single update SHOULD be delivered if the location is significantly different from the last value the site received while it was fully active.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.
Yep that's what I wanted to say. I guess we need to track the last position when the page becomes not fully active / visible then, so that we can compare it to the position when it becomes fully active & visible again?
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.
@reillyeon wrote:
That's true, but iff the document is visible (and fully active).
If the document transitions from "hidden" to "visible", it's perfectly reasonable for the page to call
getCurrentPosition()
to get a position update. But,.watchPosition()
must only receive new significant position changes when visible. That is, if the page was hidden and there was a significant update, then that's too bad/too late - it has to wait for the next significant change.See code below.
@rakina wrote:
My opinion is that we don't need to go to this level, because it can be handled by the developer:
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.
I guess that sounds reasonable, for the bfcache case web devs can listen for the
pageshow
event as well. I guess I'm a bit worried that most web devs are not aware of bfcache and thus might miss this edge case (and we kinda want to have existing pages to "just work" with bfcache), but I don't really have a strong opinion on this so I'll trust your decision here!