Skip to content

Split the cancel out of ConnectButton into its own button #164

Description

@fernandomg

User story / Problem statement

Currently, ConnectButton cancels the connect when clicked while it reads "Connecting…". A double-click on Connect therefore connects and cancels itself, and a button whose label says one thing and whose click does another is a trap. Raised in this review comment on #142.

Expected outcome

ConnectButton only connects and is inert while pending, as before #142. A new CancelConnectButton only cancels and is inert when nothing is connecting. A double-click on either does nothing past the first click. The prompt in dapp/frontend shows the cancel button beside the connect button instead of the "(click to cancel)" hint.

Acceptance criteria

  • ConnectButton is inert while pending, with the disabled look back in canton-theme
  • CancelConnectButton ships on the /connect sub-path with anatomy, theme rules, tests and docs
  • CancelConnectButton is inert (aria-disabled) when nothing is connecting
  • Double-clicking either button has no effect past the first click
  • ConnectPrompt renders both buttons and drops the hint

Alternatives considered

  • Ignore multi-clicks with event.detail > 1 in composeAction: one line, but one button keeps doing two things
  • Arm the cancel after a delay: timing-based and surprising

Technical notes

Keep both buttons mounted and in place while connecting: if the connect button takes the cancel button's spot, the second click of a double-click starts a new connect.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions