Skip to content

Wire discard dialog for Shipping Address Element - #14978

Merged
cttsai-stripe merged 6 commits into
masterfrom
cttsai/address-element-discard-dialog-sae
Oct 19, 2026
Merged

cttsai-stripe merged 6 commits into
masterfrom
cttsai/address-element-discard-dialog-sae

Conversation

@cttsai-stripe

@cttsai-stripe cttsai-stripe commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Shipping Address Element now asks before dismissal through Close, root Back, or the sheet scrim. Cancel keeps editing; Discard reports cancellation and returns the existing canceled result. This stage prompts for every SAE dismissal, including unchanged input; standalone Address Element still cancels directly.

Motivation

Build on #14971's cancellation state so confirmation, saving, and completion share one state owner. The Activity renders the dialog from ConfirmingCancellation; Discard enters the existing Canceling path, which records analytics before publishing the result.

The dialog inherits the shared Activity theme from #15039.

During confirmation the form is disabled, but saving is not in progress. The save spinner therefore follows Saving specifically.

Flow

stateDiagram-v2
    Idle --> ConfirmingCancellation: SAE dismissal
    ConfirmingCancellation --> Idle: Cancel
    ConfirmingCancellation --> Canceling: Discard
    Idle --> Canceling: Standalone dismissal
    Canceling --> Finished: Report cancellation, then complete
Loading

The follow-up #14848 adds address and checkbox change detection and enables confirmation for standalone Address Element.

Testing

  • Added tests
  • Modified tests
  • Manually verified

Local AddressElementActivityTest and AddressElementActivityAnalyticsTest passed, along with all six appearance/theme snapshots. The new hide-gate test failed as expected when Finished rejected hiding, then passed after restoring the correct behavior. Snapshots were renamed for the rule-driven appearance matrix with no image changes. No emulator checks for this revision.

Screenshots

Default light Default dark
Discard dialog in light mode Discard dialog in dark mode

Changelog

No entry: this stage changes only Shipping Address Element, which is guarded by @RestrictTo(LIBRARY_GROUP).

Committed and created by Codex.

@cttsai-stripe
cttsai-stripe added this pull request to stack #14979 October 9, 2026 23:51
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/address-element-discard-dialog-sae branch from c7e8282 to bc90cc3 Compare October 15, 2026 17:58
@cttsai-stripe
cttsai-stripe removed this pull request from stack #14979 October 15, 2026 23:07
@cttsai-stripe
cttsai-stripe changed the base branch from master to cttsai/address-element-saving-indicator October 15, 2026 23:07
@cttsai-stripe
cttsai-stripe added this pull request to stack #15031 October 15, 2026 23:07
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/address-element-discard-dialog-sae branch 3 times, most recently from ac6afff to 2b84365 Compare October 16, 2026 05:15
@cttsai-stripe
cttsai-stripe removed this pull request from stack #15031 October 16, 2026 05:30
@cttsai-stripe
cttsai-stripe changed the base branch from cttsai/address-element-saving-indicator to master October 16, 2026 05:31
@cttsai-stripe
cttsai-stripe added this pull request to stack #15035 October 16, 2026 05:31
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/address-element-discard-dialog-sae branch from 2b84365 to ccd2b19 Compare October 16, 2026 05:34
@cttsai-stripe
cttsai-stripe removed this pull request from stack #15035 October 16, 2026 16:58
@cttsai-stripe
cttsai-stripe changed the base branch from master to cttsai/address-element-shared-theme October 16, 2026 16:58
@cttsai-stripe
cttsai-stripe added this pull request to stack #15040 October 16, 2026 16:58
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/address-element-discard-dialog-sae branch 2 times, most recently from a16fa3d to d1914c5 Compare October 16, 2026 17:08
Base automatically changed from cttsai/address-element-shared-theme to master October 16, 2026 17:49
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/address-element-discard-dialog-sae branch from d1914c5 to 0108b7e Compare October 16, 2026 17:49
cttsai-stripe and others added 2 commits October 16, 2026 11:01
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
}

@Test
fun `checkout shipping close requests confirmation when input is unchanged`() = runScenario {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This will change in a later PR.

@cttsai-stripe
cttsai-stripe force-pushed the cttsai/address-element-discard-dialog-sae branch from 5943072 to c912377 Compare October 16, 2026 18:28
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@cttsai-stripe
cttsai-stripe force-pushed the cttsai/address-element-discard-dialog-sae branch from c912377 to 3fa0b26 Compare October 16, 2026 18:52
@cttsai-stripe
cttsai-stripe marked this pull request as ready for review October 16, 2026 19:30
@cttsai-stripe
cttsai-stripe requested review from a team as code owners October 16, 2026 19:30
Comment on lines +74 to +77
else -> {
dismiss()
false
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is there any risk to this change? I'm concerned about bugs where a customer is unable to dismiss the address element

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a test finished cancellation allows the sheet to hide without requesting confirmation again to prevent regression.

cttsai-stripe and others added 2 commits October 19, 2026 10:26
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
Committed-By-Agent: codex
Co-authored-by: codex <noreply@openai.com>
@cttsai-stripe
cttsai-stripe merged commit 32bd5fd into master Oct 19, 2026
41 checks passed
@cttsai-stripe
cttsai-stripe deleted the cttsai/address-element-discard-dialog-sae branch October 19, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants