diff --git a/django/contrib/admin/static/admin/js/nav_sidebar.js b/django/contrib/admin/static/admin/js/nav_sidebar.js index d262c26bb2..86cb1cf837 100644 --- a/django/contrib/admin/static/admin/js/nav_sidebar.js +++ b/django/contrib/admin/static/admin/js/nav_sidebar.js @@ -74,7 +74,7 @@ } else { event.target.classList.add('no-results'); } - localStorage.setItem('django.admin.navSidebarFilterValue', filterValue); + sessionStorage.setItem('django.admin.navSidebarFilterValue', filterValue); } const nav = document.getElementById('nav-filter'); @@ -82,7 +82,7 @@ nav.addEventListener('input', checkValue, false); nav.addEventListener('keyup', checkValue, false); - const storedValue = localStorage.getItem('django.admin.navSidebarFilterValue'); + const storedValue = sessionStorage.getItem('django.admin.navSidebarFilterValue'); if (storedValue) { nav.value = storedValue; checkValue({target: nav, key: ''}); diff --git a/tests/admin_views/test_nav_sidebar.py b/tests/admin_views/test_nav_sidebar.py index c2e45d91a2..102e4d0064 100644 --- a/tests/admin_views/test_nav_sidebar.py +++ b/tests/admin_views/test_nav_sidebar.py @@ -167,7 +167,7 @@ class SeleniumTests(AdminSeleniumTestCase): reverse('test_with_sidebar:auth_user_changelist') ) filter_value_script = ( - "return localStorage.getItem('django.admin.navSidebarFilterValue')" + "return sessionStorage.getItem('django.admin.navSidebarFilterValue')" ) self.assertIsNone(self.selenium.execute_script(filter_value_script)) filter_input = self.selenium.find_element_by_css_selector('#nav-filter')