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

Annotation scrolling to line UI bug fix #1807

Merged
merged 2 commits into from
Feb 12, 2023
Merged

Conversation

lykimchee
Copy link
Member

Description

Changed app/assets/javascripts/annotations.js to fix the scroll animation jumping around when clicking on an annotation that was already in view. (Issue #1665 No. 5)

The jumping animation was caused due to the entire code file being reloaded every time a user clicked on an annotation link (inside annotations.js, the function attachChangeFileEvents would always call changeFile and thus reload the code pane). This was fixed by adding a check to ensure changeFile would only be called if the header position (code file) of the annotation clicked was different from the current code file in view.

Motivation and context

Previously, when we clicked on an annotation on the right side bar, we would start scrolling from the top of the code viewer each time (even if the annotation was already in view), which resulted in a buggy animation.

Before changes:
before

After changes:
after

How has this been tested?

To test this bug fix, create a submission with multiple files (with at least one multiline file long enough to require scrolling within the Autolab submission viewer). Then, write an annotation for any line in the multiline file (preferably on a line not initially visible when the file is loaded, such that you have to scroll in order to view the line), and annotations in other files as well. Test by clicking annotations on the right side bar when:

  • [Within the multiline file] The annotated line is not in view (is below your current position on the file)
  • [Within the multiline file] The annotated line is not in view (is above your current position on the file)
  • [Within the multiline file] The line is in view
  • [Within any file] Click an annotation for a line inside another file
  • [For any annotation] Immediately after clicking the annotation (so the annotation should've already been scrolled to)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have run rubocop for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting
  • My change requires a change to the documentation, which is located at Autolab Docs
  • I have updated the documentation accordingly, included in this PR

@damianhxy damianhxy linked an issue Feb 10, 2023 that may be closed by this pull request
Copy link
Member

@damianhxy damianhxy left a comment

Choose a reason for hiding this comment

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

LGTM :)

@lykimchee lykimchee added this pull request to the merge queue Feb 12, 2023
Merged via the queue into master with commit 38868d0 Feb 12, 2023
@lykimchee lykimchee deleted the scrolling-annotation-bug branch February 12, 2023 18:44
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.

Scrolling to an Annotation from Sidebar
3 participants