Skip to main content

Module approval

Module approval 

Source
Expand description

A request for permission to do one specific thing.

Everything here is arranged around one rule: the default is refusal. Nothing in this component makes approving easier than declining by accident.

  • The keyboard lands on the decline control when the prompt appears, the way Dialog opens a destructive confirmation on cancel.
  • Return acts on the control that has the keyboard and on nothing else, so a return key pressed at the wrong moment declines. Approving with the keyboard takes a deliberate tab first.
  • Escape declines, which is what escape does everywhere else in this library, and is the safe direction here rather than merely the conventional one.
  • A resolved prompt installs no handler at all.

§An unscoped “always” cannot be built

AlwaysScope has no variant that means “always, everywhere”. Every variant either is the session itself or carries the one thing it is always for, and the wording on the control is derived from that variant, so a control offering “always” without saying what “always” covers is not a thing a caller can construct.

§A prompt that was never answered was not refused

ApprovalStatus keeps Declined, Expired and Superseded apart. They are three different facts about what happened — a person said no, nobody said anything in time, and a later request took this one’s place — and each is rendered and published differently.

Structs§

ApprovalPrompt
One request for permission, with the answer left to the caller.

Enums§

AlwaysScope
What a standing approval covers.
ApprovalDecision
How far an approval reaches.
ApprovalEvent
What the prompt reports. It applies none of it.
ApprovalStatus
What has happened to this request.