Opened 6 months ago

Last modified 4 days ago

#35798 new Bug

Admin sidebar still flashes when page loads

Reported by: Mario Munoz Owned by: Gavin Wahl
Component: contrib.admin Version: 5.0
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: yes
Pull Requests:19324 merged, 16248 merged

Description

This new ticket is based on https://code.djangoproject.com/ticket/31641 which had been closed previously.

Currently, there is a <script src="{% static 'admin/js/nav_sidebar.js' defer %}"></script> tag within the <head> element of the base template. This means that sometimes the sidebar renders before the script runs, which sometimes causes a flash/flicker when you reload the page.

I was able to reproduce this locally. To do this, I needed to hide the sidebar, then show again, then reload the browser. Upon subsequent reloads, there would be an occasional flicker.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (11)

comment:1 by Mario Munoz, 6 months ago

When moving the script tag to be listed in the nav_sidebar.html (after the code), it will no longer run the script until after the sidebar has rendered.

I reproduced the steps I used to verify the flicker was present, but after this change, I could no longer reproduce the effect. It seems to have fixed the issue.

I'm not sure if there is any testing to be set up for this.

comment:3 by Thibaud Colas, 6 months ago

Triage Stage: UnreviewedAccepted

Confirm the issue from #31641 is still present.

comment:4 by Sarah Boyce, 6 months ago

Owner: changed from Mario Munoz to Gavin Wahl

comment:5 by Sarah Boyce, 6 months ago

Triage Stage: AcceptedReady for checkin

comment:6 by Sarah Boyce <42296566+sarahboyce@…>, 6 months ago

Resolution: fixed
Status: assignedclosed

In 747b417:

Fixed #35798, Refs #31641 -- Prevented admin navigation sidebar loading flicker.

Thank you to Mario Munoz and Thibaud Colas for the testing and review.

comment:7 by Sarah Boyce <42296566+sarahboyce@…>, 4 days ago

In 12385b4f:

Fixed #36283 -- Reverted "Fixed #35798, Refs #31641 -- Prevented admin navigation sidebar loading flicker."

This reverts commit 747b417a220b0412ed806001a383959449aac6da that caused
a visual regression when both navigation and filter sidebars are
visible.

comment:8 by Sarah Boyce <42296566+sarahboyce@…>, 4 days ago

In 88ca180b:

[5.2.x] Fixed #36283 -- Reverted "Fixed #35798, Refs #31641 -- Prevented admin navigation sidebar loading flicker."

This reverts commit 747b417a220b0412ed806001a383959449aac6da that caused
a visual regression when both navigation and filter sidebars are
visible.

Backport of 12385b4fa7059aab8e4f671853cc09ae8509501f from main.

comment:9 by Sarah Boyce, 4 days ago

Resolution: fixed
Status: closednew

comment:10 by Sarah Boyce, 4 days ago

Triage Stage: Ready for checkinAccepted

comment:11 by Sarah Boyce, 4 days ago

Has patch: unset
Note: See TracTickets for help on using tickets.
Back to Top