openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

Browser back button is not working as expected #24

Closed moui72 closed 7 years ago

boonebgorges commented 8 years ago

I'm going to flesh this out with what I assume you mean in the ticket title:

a. Back button works properly when navigating between single-question and question index. Eg: from http://openlabdev.org/webwork-playground/, click a question header; the back button will return you to the main page. b. Back button does not work with index filters. Eg, visiting http://openlabdev.org/webwork-playground/ and clicking "Unanswered Questions" will change the view so that you're viewing unanswered questions; Back does not take you to the unfiltered view.

If this doesn't accurately capture your report, please provide more details.

The primary issue here is that I'm not modifying the URL when filtering the index page. The entire application runs in JS, and uses hash navigation, which doesn't change when selecting a filter. I'll have to solve this by either (a) interacting with the URL when applying sidebar filters, or (b) manually modifying the browser history.

moui72 commented 8 years ago

Thanks for picking up the slack on this, I meant to put a comment in but screwed it up somehow. Your description sounds right. Might be useful also or instead to have the filter breadcrumbs be interactive and include a clear filters button up there.

On Tue, Aug 16, 2016, 2:13 PM Boone Gorges notifications@github.com wrote:

I'm going to flesh this out with what I assume you mean in the ticket title:

a. Back button works properly when navigating between single-question and question index. Eg: from http://openlabdev.org/webwork-playground/, click a question header; the back button will return you to the main page. b. Back button does not work with index filters. Eg, visiting http://openlabdev.org/webwork-playground/ and clicking "Unanswered Questions" will change the view so that you're viewing unanswered questions; Back does not take you to the unfiltered view.

If this doesn't accurately capture your report, please provide more details.

The primary issue here is that I'm not modifying the URL when filtering the index page. The entire application runs in JS, and uses hash navigation, which doesn't change when selecting a filter. I'll have to solve this by either (a) interacting with the URL when applying sidebar filters, or (b) manually modifying the browser history.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/livinglab/webwork-for-wordpress/issues/24#issuecomment-240189119, or mute the thread https://github.com/notifications/unsubscribe-auth/ADtKPETfXa-sL9xntFf7vpIM03hAhlOqks5qgf2_gaJpZM4JlpsK .

boonebgorges commented 8 years ago

Thanks, @moui72 !

I'm going to add some additional test info passed along by Andrew. Essentially, it boils down to the directory filters not be reset when hitting Back from a single problem page:

I then hit the back button on my browser, where “problem set 19” was still selected in the filter menu – but the page displayed (presumably) all the questions from all the sets (there was no indication on the page that I was still filtering by set either). Attempting to re-filter by problem set 19 did nothing (presumably because set 19 was already selected to begin with), so I tried picking another set (10b). The top of the page now displayed Filtered by: 10b, but the displayed questions did not change. I still was presented with problems from the other sets. Now attempting to switch back to set 19, the top of the page changed to Filtered by: 19, but the displayed questions again did not change. (Side note – the dropdown menu listing the sets by which I could filter now contained two extra “-” choices, three in total.) Every time I tried to switch to filter by a new set, the “Filtered by” would reflect the requested set, but the question list continued displaying all questions from all sets. (Additionally, a new “-” was added to the dropdown menu each time.)

boonebgorges commented 8 years ago

This is roughly half fixed. The really weird behavior that was causing filters not to be reset when navigating using the back button between the single-question view and the index now appear to be resolved.

Back button does not work with index filters. Eg, visiting http://openlabdev.org/webwork-playground/ and clicking "Unanswered Questions" will change the view so that you're viewing unanswered questions; Back does not take you to the unfiltered view.

This is quite a bit harder to implement, but less important for the time being, I think. Let's handle it in a future release.

moui72 commented 8 years ago

OK. Confirmed that (a) above is working.

Related to (b) for a future release is that it might be nice for the filter state to be remembered (that is, you returned to the same list you navigated away from) when navigating back to the question list from a question detail page.

boonebgorges commented 7 years ago

This is quite a bit harder to implement, but less important for the time being, I think. Let's handle it in a future release.

This was an understatement. I had to rewrite the routing logic for the entire application. But I think it's working now - ready for testing on openlabdev.org. A few notes:

boonebgorges commented 7 years ago

(A bit of quick testing on openlabdev.org/webwork-playground suggests that there may be issues with duplicate questions being loaded in some cases - please pay attention to this in testing, and if you identify patterns, let me know.)

boonebgorges commented 7 years ago

I think I found the problem with dupes, so hopefully you won't have to discover that pattern :)

moui72 commented 7 years ago

great work! no issues so far

moui72 commented 7 years ago

@drdrew42, @bree-z if you notice any issues with browser back not working as you expect, please repon and update this ticket

otherwise I think this is OK

drdrew42 commented 7 years ago

I'll do more testing on this, don't have the time right now - but I was just fiddling around and lost all filters when using the back button. Safari 10.1.1 on MacOS 10.12.5

EDIT: Don't mind me - the changes likely haven't been pushed to the public server! D'oh.