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

Don't show view switcher until annotations received #481

Conversation

seanh
Copy link
Contributor

@seanh seanh commented Jul 3, 2017

Don't show the view switcher until the first batch of annotations has
been received. (This first batch will be all the annotations, unless
there are more than 200 annotations of the page.)

This is an attempt to reduce "popping" caused by the annotation switcher
suddenly changing a brief time after first render, when annotations are
loaded:

hypothesis/product-backlog#327 (comment)

@seanh
Copy link
Contributor Author

seanh commented Jul 3, 2017

I haven't added any tests for this. I want to get it out to production (its behind a feature flag) first and see whether it achieves the aim of reducing the popping effect / how it looks on production

@seanh seanh force-pushed the dont-show-view-switcher-until-first-batch-of-annotations-received branch from 2d54fb1 to 7241aca Compare July 3, 2017 16:44
@codecov
Copy link

codecov bot commented Jul 3, 2017

Codecov Report

Merging #481 into master will increase coverage by 0.18%.
The diff coverage is 80%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #481      +/-   ##
==========================================
+ Coverage    89.9%   90.09%   +0.18%     
==========================================
  Files         134      134              
  Lines        5232     5400     +168     
  Branches      903      941      +38     
==========================================
+ Hits         4704     4865     +161     
- Misses        528      535       +7
Impacted Files Coverage Δ
src/sidebar/components/view-switcher.js 78.26% <80%> (+0.48%) ⬆️
src/annotator/plugin/cross-frame.coffee 100% <0%> (ø) ⬆️
src/shared/polyfills.js 100% <0%> (ø) ⬆️
src/sidebar/frame-sync.js 95% <0%> (+1.31%) ⬆️
src/annotator/util/frame-util.js 86.95% <0%> (+1.66%) ⬆️
src/annotator/guest.coffee 84.7% <0%> (+5.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84d4b3f...f240476. Read the comment docs.

Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

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

Couple of minor comments. Otherwise LGTM.

@@ -34,6 +42,7 @@ module.exports = {
isLoading: '<',
isWaitingToAnchorAnnotations: '<',
selectedTab: '<',
showViewSwitcher: '<',
Copy link
Member

Choose a reason for hiding this comment

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

The list of properties in the bindings section are inputs to the component, ie. attributes in the list provided to <view-switcher> in templates that use the component. showViewSwitcher is an internal controller method however, so it doesn't need to be here.

getState: sinon.stub().returns({
frames: [
{
isAnnotationFetchComplete: true,
Copy link
Member

Choose a reason for hiding this comment

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

A short comment here would be useful to explain what this is for.

Don't show the view switcher until the first batch of annotations has
been received. (This first batch will be all the annotations, unless
there are more than 200 annotations of the page.)

This is an attempt to reduce "popping" caused by the annotation switcher
suddenly changing a brief time after first render, when annotations are
loaded:

hypothesis/product-backlog#327 (comment)
@seanh seanh force-pushed the dont-show-view-switcher-until-first-batch-of-annotations-received branch from 7241aca to f240476 Compare July 5, 2017 11:38
Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

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

LGTM.

@@ -19,6 +19,14 @@ module.exports = {
return features.flagEnabled('orphans_tab');
};

this.showViewSwitcher = function() {
var frame = annotationUI.getState().frames[0];
Copy link
Member

Choose a reason for hiding this comment

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

I'll note that this list may be empty early in the life of the application when the top-level frame has not yet connected. In that case this will be an out-of-bounds access, which returns undefined. This works fine in JS, but I generally prefer to explicitly handle the case.

@robertknight robertknight merged commit 0c4a7c7 into master Jul 5, 2017
@robertknight robertknight deleted the dont-show-view-switcher-until-first-batch-of-annotations-received branch July 5, 2017 12:12
seanh added a commit that referenced this pull request Jul 31, 2017
Remove the (feature-flagged) view switcher component.

We missed the chance to strike while the iron was hot on this one -
neither Dawa or I have time anymore to work on further design
iterations. I don't want to have dead code living behind a feature flag
so I'm removing it. The code will still be in git if we ever want to
revive it. Perhaps these tabs can be re-designed as part of a larger
re-design of the sidebar in the future.

I'll leave the GitHub issue about the usability issues with the existing
selection tabs open: hypothesis/product-backlog#327

For the record the main remaining issues with this were:

1. An undesirable visual popping happens when the view switcher loads on
pages that have a lot of annotations. This also happens with the
existing selection tabs but is arguably more visible with the view
switcher.

2. When there are only two tabs (no orphans) the visual design of the
tabs doesn't make it as immediately obvious which is the currently
selected tab. The other tab may be mistaken for the selected one.

The TODO list was here:

hypothesis/product-backlog#327 (comment)

The pull requests for this view switcher were:

#429
#481
#482
hypothesis/product-backlog#327
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

Successfully merging this pull request may close these issues.

2 participants