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

Add scroll-to-top when switching verticals from bottom nav buttons. #597

Merged
merged 2 commits into from
Sep 25, 2013

Conversation

mlsteele
Copy link
Contributor

@mlsteele mlsteele commented Aug 6, 2013

Bug: When a student finishes a tall vertical and clicks the next arrow at the bottom of the page, the vertical advances but the students view remains at the bottom of the page.

This adds a scroll to top when the students clicks the nav buttons at the bottom of the page.
Also, a small refactor so that the buttons call the same method with an argument of seq_next or seq_prev.

Reviewers:
@rlucioni
@jkarni

@render new_position
# `direction` can be 'seq_prev' or 'seq_next'
_change_sequential: (direction, event) =>
console.log "_change_sequential #{direction}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove? We didn't print to the console originally, and we're already making calls to our Logger and Segment.io's API.

@rlucioni
Copy link
Contributor

rlucioni commented Aug 6, 2013

I like the refactor.

I'm getting the scrollup when I trigger a goto, and when I click a greyed-out arrow (i.e., can't go further left or right). Do we want this behavior?

@rlucioni
Copy link
Contributor

rlucioni commented Aug 6, 2013

I'm also getting the scrollup when I use the top nav, even though it seems like it should only happen when the bottom nav is used.

sequence_id: @id
current_sequential: @position
target_sequential: new_position

# If the bottom nav is used, scroll to the top of the page on change.
if $(event.target).parent().parent().parent().hasClass 'sequence-bottom'
Copy link

Choose a reason for hiding this comment

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

All those parent() calls look very fragile. Maybe use .closest('nav[class="sequence-bottom"]') (or whatever it may be) and check whether that's non-empty.

@mlsteele
Copy link
Contributor Author

mlsteele commented Aug 7, 2013

  • removed print
  • added .closest

@mlsteele
Copy link
Contributor Author

mlsteele commented Aug 7, 2013

When any grey arrow is clicked, the page scrolls to the top. This is bad, but it doesn't call next or previous. That may be worth hunting down in a different PR.

@jkarni
Copy link

jkarni commented Aug 7, 2013

Could you add/update the tests in spec/sequence/display?

@mlsteele
Copy link
Contributor Author

@jkarni added test.

@@ -142,6 +142,9 @@ xdescribe 'Sequence', ->
it 'call render on the next sequence', ->
expect($('#seq_content').html()).toEqual 'Sample Problem'

it 'scrolls to the top of the page', ->
expect($.fn.scrollTo).toHaveBeenCalled()

Copy link

Choose a reason for hiding this comment

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

This doesn't actually test the function's expected behavior. I'd say use $scrollTop instead, and check that it's 0 for the right element.

@jkarni
Copy link

jkarni commented Aug 19, 2013

👍 if build passes.

@rlucioni
Copy link
Contributor

Clicking greyed-out nav arrows still scrolls us to the top. As @mlsteele mentioned, this may be worth hunting down in a separate PR. Otherwise, 👍

@rlucioni
Copy link
Contributor

@jkarni, are we merging this in?

@jkarni
Copy link

jkarni commented Sep 18, 2013

@rlucioni I hadn't actually tried reproducing the issue you mentioned. Now I see that I can't - do you mean the bottom button, once you've gone as far in a direction as you can?

@rlucioni
Copy link
Contributor

I was referring to both top and bottom buttons. I'll try again to see if I can reproduce it.

@rlucioni
Copy link
Contributor

I can't reproduce the issue, so I say :shipit:.

jkarni pushed a commit that referenced this pull request Sep 25, 2013
Add scroll-to-top when switching verticals from bottom nav buttons.
@jkarni jkarni merged commit 7bd5454 into master Sep 25, 2013
@jkarni jkarni deleted the feature/msteele/scrollup branch September 25, 2013 15:38
chrisrossi pushed a commit to jazkarta/edx-platform that referenced this pull request Mar 31, 2014
mtyaka referenced this pull request in open-craft/edx-platform Feb 10, 2016
caesar2164 pushed a commit to caesar2164/edx-platform that referenced this pull request Apr 27, 2017
* vagupta16/fix-sneakpeek-enroll-nonexistent-course:
  Prevent sneakpeeks of nonexistent courses
dgamanenko referenced this pull request in raccoongang/edx-platform Jun 14, 2018
…ucture-url

Proversity/grades api structure url
yoann-mroz pushed a commit to weuplearning/edx-platform that referenced this pull request Nov 30, 2020
mariajgrimaldi pushed a commit to eduNEXT/edx-platform that referenced this pull request Dec 17, 2021
Sujeet1379 pushed a commit to chandrudev/edx-platform that referenced this pull request Nov 17, 2022
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.

3 participants