#35943: Remove deprecated 'unload' event listener
--------------------------------------+------------------------------------
Reporter: Adam Johnson | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: contrib.admin | Version: dev
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Natalia Bidart):
* stage: Unreviewed => Accepted
Old description:
New description:
[
https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event
pagehide] as a more reliable alternative, which seems like it would be
compatible with the goal of closing child popups.
--
Comment:
Thank you Adam for taking the time to create this ticket, and for linking
adequate resources to do proper triage.
I'm accepting on the basis that this makes sense but I would like to see
more research being done regarding what to use to replace `unload`. The
linked MDN docs say:
> The pagehide event is sent to a Window when the browser hides the
current page in the process of presenting a different page from the
session's history.
> For example, when the user clicks the browser's Back button, the current
page receives a pagehide event before the previous page is shown.
Is not immediately clear to me that this is a good replacement. From
[
https://developer.chrome.com/docs/web-platform/deprecating-unload these
Chrome docs] we may need to evaluate `visbilitychange` as well.
--
Ticket URL: <
https://code.djangoproject.com/ticket/35943#comment:1>