Opened 14 months ago
Last modified 9 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 |
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.
Change History (13)
comment:1 by , 14 months ago
comment:3 by , 14 months ago
| Triage Stage: | Unreviewed → Accepted |
|---|
Confirm the issue from #31641 is still present.
- Demo page where this is reproducible in
main: /admin/admin/logentry/. - Demo page for the PR with the fix: preview-16248.
comment:4 by , 14 months ago
| Owner: | changed from to |
|---|
comment:5 by , 14 months ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
comment:9 by , 8 months ago
| Resolution: | fixed |
|---|---|
| Status: | closed → new |
comment:10 by , 8 months ago
| Triage Stage: | Ready for checkin → Accepted |
|---|
comment:11 by , 8 months ago
| Has patch: | unset |
|---|
comment:13 by , 11 days ago
Hi, I’d like to start working on this issue.
Before I begin, just checking whether anyone is currently preparing a patch.
If not, I’ll start by reproducing the flicker and explore a fix that works for both navigation and filter sidebars without causing regressions.
Thanks!
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.