Skip to content

fix(zone.js): allow enabling default beforeunload handling#55875

Closed
arturovt wants to merge 1 commit intoangular:mainfrom
arturovt:fix/zone-beforeunload
Closed

fix(zone.js): allow enabling default beforeunload handling#55875
arturovt wants to merge 1 commit intoangular:mainfrom
arturovt:fix/zone-beforeunload

Conversation

@arturovt
Copy link
Copy Markdown
Contributor

@arturovt arturovt commented May 19, 2024

Prior to this commit, when zone.js was included, it wasn't possible to handle beforeunload events correctly if event handlers returned strings to prompt the user.

With this change, we introduce a global configuration flag, __zone_symbol__enable_beforeunload, to allow consumers to enable the default beforeunload handling behavior.

This flag is necessary to prevent any breaking changes resulting from this modification. The previous attempt to fix it caused a large number of failures in G3. Hence, we're hiding that fix behind the configuration flag.

Closes #47579
Closes #52256

Prior to this commit, when zone.js was included, it wasn't possible to handle `beforeunload`
events correctly if event handlers returned strings to prompt the user.

With this change, we introduce a global configuration flag,
`__zone_symbol__enable_beforeunload`, to allow consumers to enable the default
`beforeunload` handling behavior.

This flag is necessary to prevent any breaking changes resulting from this modification.
The previous attempt to fix it caused a large number of failures in G3. Hence, we're
hiding that fix behind the configuration flag.

Closes angular#47579
@arturovt arturovt marked this pull request as ready for review May 19, 2024 15:29
@pullapprove pullapprove Bot requested a review from JiaLiPassion May 19, 2024 15:29
@dylhunn dylhunn added the area: zones Issues related to zone.js label May 22, 2024
@ngbot ngbot Bot added this to the Backlog milestone May 22, 2024
Copy link
Copy Markdown
Contributor

@JiaLiPassion JiaLiPassion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@AndrewKushnir AndrewKushnir added target: patch This PR is targeted for the next patch release requires: TGP This PR requires a passing TGP before merging is allowed action: global presubmit The PR is in need of a google3 global presubmit labels Jun 6, 2024
@pullapprove pullapprove Bot removed action: global presubmit The PR is in need of a google3 global presubmit requires: TGP This PR requires a passing TGP before merging is allowed labels Jun 6, 2024
@AndrewKushnir AndrewKushnir self-assigned this Jun 6, 2024
@pullapprove pullapprove Bot added the action: global presubmit The PR is in need of a google3 global presubmit label Jun 6, 2024
@AndrewKushnir
Copy link
Copy Markdown
Contributor

Global Presubmit.

@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: global presubmit The PR is in need of a google3 global presubmit labels Jun 12, 2024
@AndrewKushnir
Copy link
Copy Markdown
Contributor

Caretaker note: TGP is "green", this PR is ready for merge.

alxhub pushed a commit that referenced this pull request Jun 12, 2024
Prior to this commit, when zone.js was included, it wasn't possible to handle `beforeunload`
events correctly if event handlers returned strings to prompt the user.

With this change, we introduce a global configuration flag,
`__zone_symbol__enable_beforeunload`, to allow consumers to enable the default
`beforeunload` handling behavior.

This flag is necessary to prevent any breaking changes resulting from this modification.
The previous attempt to fix it caused a large number of failures in G3. Hence, we're
hiding that fix behind the configuration flag.

Closes #47579

PR Close #55875
@alxhub
Copy link
Copy Markdown
Member

alxhub commented Jun 12, 2024

This PR was merged into the repository by commit b8d5882.

@alxhub alxhub closed this in b8d5882 Jun 12, 2024
@arturovt arturovt deleted the fix/zone-beforeunload branch June 12, 2024 20:06
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Jul 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: zones Issues related to zone.js merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Angular 16 @HostListener('window:beforeunload', ['$event']) is not working beforeunload return value is not respected

5 participants