jupyter / nbgrader

A system for assigning and grading notebooks
https://nbgrader.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.28k stars 316 forks source link

Stop nbgrader JupyterLab formgrader tab from scrolling back to top #1841

Open ianalis opened 11 months ago

ianalis commented 11 months ago

I'm using nbgrader on JupyterLab. When I manually grade on a formgrader tab, switch to a different JupyterLab tab, say, to look at the expected solution, then go back to the formgrader tab, it scrolls back to top. This is very frustrating, distracting and time wasting that my workaround is to use the notebook interface instead of lab when manually grading. Is there a way to stop formgrader from scrolling back to top?

Operating system

Ubuntu 22.04.3 LTS

nbgrader --version

Python version 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0] nbgrader version 0.8.5

jupyterhub --version (if used with JupyterHub)

4.0.2

jupyter notebook --version

6.5.2

jupyter lab --version

3.6.6

Expected behavior

The formgrader (manual grading) tab should not scroll at all when you come back to it after switching to a different JupyterLab tab.

Actual behavior

The formgrader (manual grading) tab scrolls to top after switching to a different JupyterLab tab.

Steps to reproduce the behavior

  1. Manually grade a submission then scroll down.
  2. Switch to a different JupyterLab tab (e.g., different notebook or terminal).
  3. Switch back to the formgrader tab where you are manually grading.
lahwaacz commented 11 months ago

Another case where formgrader scrolls to the top for no reason:

  1. Scroll down on the Manage Assignments / Manage Submissions page.
  2. Click on the Autograde, Generate Feedback, or Release Feedback button for a particular row in the table.
brichet commented 9 months ago

Thanks @ianalis for reporting this issue.

Strangely, I can only reproduce it on chrome based web browser. At least it does not occur with Firefox on my side.

The Formgrader panel's content is an iframe, I'm wondering if this is related to the management of iframe in chrome.

ianalis commented 9 months ago

I did a quick google search and found this to be possibly useful. It also has a workaround/fix (use visibility instead of display) but I don't know if it's relevant to our case.

brichet commented 9 months ago

Thanks @ianalis for the link.

When a jupyterlab tab is not visible, it get the class .lm-mod-hidden, which has the style

.lm-Widget.lm-mod-hidden {
    display: none !important;
}

This is not the iframe but its parent that get the display: none property, so maybe this is the same issue. If this is the case, it can probably not be fixed in nbgrader while it is using an iframe.

ianalis commented 9 months ago

I can confirm that changing the rule to visibility: hidden !important; will stop the iframe from scrolling back to top.

image