-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Add a modern CSS spinner #427
Conversation
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.
Thanks a lot for this PR!
I agree with you about #426 being a separate issue.
I did not see #361 symptoms.
A few minor remarks :
- I tend to find the new spinner could be a bit more visible. For example by using a bit stronger colors. But it's only a personal opinion
- The new "Caching styles" is pretty, but might be a bit more visible too. For example by adding a border around. Or displaying it next to the spinner. But that might be discussed too.
- In jQuery mode, when scrolling down and clicking on a hyperlink, there's an annoying behavior : the spinner is visible, then the page scrolls up, and afterwards this page is replaced by the new page. I suppose the
$("#articleContent").contents().scrollTop(0);
is done too early. I think this scrolling is not necessary any more? Else it might be moved in the onload event, so that it happens later? - Regarding
$('#articleContent').contents().remove();
in ServiceWorker mode, I don't remember why this line was needed at some time. It seems to work fine without it.
Thanks @mossroy :
|
Hi @mossroy , if you get a moment, could you give me an opinion on the (visual) implementation now?
Note that the caching message(s) will only show in jQuery mode, as the cache isn't implemented for SW mode. Also the caching message will only be displayed on first load of the landing page, and very rarely on a page that needs a new CSS file that has not yet been cached. Specifically, does the caching message strike a good balance between being discreet but still being noticeable/informative? Is it too obtrusive? Would it be better relocated to bottom-right or top-right corners? (We can't use bottom left because many browsers use that area to show the URL of a link that has been clicked.) An example over blank background shown below (in reality it's smaller and more discreet than shown here, as Github expands the screenshot). |
I quickly tested that on Firefox and IE11 (both in jQuery mode). Visually, I find that great! I would keep it like this. But I found another possible improvement that we might do (maybe it should be a separate issue) : |
Great, thanks! I can certainly test adding a line to the onclick code to activate the spinner sooner for these edge cases. I think it can be part of this PR. I've still got code clearing-up to do and one small thing to fix from earlier discussion. I'll ask you to look over final code when it's ready (probably at weekend) before merging. |
@mossroy I've completed the pending issues (see commit titles). Could you test your slow I/O files with this final code? The spinner should display on click of UI elements in both modes, and inline article links in jQuery mode. If you get a moment to look through the code, it would be great. Quite a lot of redundant hiding and showing has been deleted. There is one thing that might need decision: I got rid of the "Reading article xxxxx ...." message before I implemented the css caching info box beneath the spinner, on the basis that users know what they've clicked on, and the spinner is enough feedback. However, it would now be possible to use the css caching info box to present that message. I tend to think it's still not necessary, and displaying the message on each page load would mean that we would always see the box. Currently it is only shown when there is new CSS to cache, so only for the first couple of page loads usually. I feel it's neater just to use the spinner as feedback. The "loss" of feedback is mitigated by the fact that the article list stays in place now until the page is ready, and when a user clicks on an inline link, browsers usually display the link in their status message bottom left. However, I thought I should point this out, since it is removing a feature that exists in master. |
I tested with the same slow I/Os (on Firefox 60ESR and IE11, both in jQuery mode) : the user feedback is much better now, with the spinner appearing right after the click. Regarding the "loss" of "Reading article xxx", I don't have a strong opinion. We can probably leave it this way : it's still possible to add it back later if we feel it's necessary. In a sense, it's also more consistent with the SW mode. I had a quick look at the code : I like to see some code removal in this hiding/showing code :-), see #78. I did not test in SW mode, but if you did, you might squash/rebase/merge this PR. |
Thanks for spotting the regression. It was a bit "random", and a puzzle, because I can't see the rogue |
Found another regression in this PR with FFOS, when clicking on a search result, we get a severely truncated display area once the new page is shown, at least in the simulator. It's to do with display of the on-screen keyboard, I guess. I need to remove the article list before that code is called... Or ensure the on-screen keyboard is removed as soon as an article is clicked, might do the trick. It's never easy!! |
OK, this commit solves that one. Again, feels a bit like brute force, but it does make sense to call I'm going to leave this till tomorrow before squashing etc. @mossroy , I don't know if you want to test on a real FFOS device first? If not, it does seem to work in the simulator. Anyway, I aim to merge early tomorrow morning unless I hear to the contrary. |
I tested on a Firefox OS device : it works perfectly fine. |
c222919
to
9e7a35c
Compare
@mossroy I've taken the CSS spinner code as far as I can without hooking into the Service Worker messaging channel. So it works fully in jQuery mode, and in a limited way in Service Worker mode: when loading a new page by searching for it, with the Random button, or when loading the landing page, but not when clicking on a link within a page. The latter would require hooking into the messaging channel, and so would require a policy decision if we want uniformity across the app. It can be left for future decision.
Regarding your comment in #425 that keeping the old page on-screen until we have the new html to replace it might cause the app to keep requesting images unnecessarily, I have done extensive testing in #426 : there is a broader issue affecting master, not this PR specifically, so I have opened a separate issue for it.
Could you please check this code and test? I'd be grateful if you could test in particular that #361 ("TypeError: can't access dead objects") is not reintroduced. It shouldn't be, as we still have the specific fix for that in place. There is also a related query embedded in a comment in app.js line 748 addressed to you, which I'll remove when the query is resolved. No rush at all!