@@ -692,6 +692,7 @@ spec:css-syntax-3;
692692 <pre class="idl">
693693 dictionary CredentialRequestOptions {
694694 CredentialMediationRequirement mediation = "optional";
695+ DOMString uiMode;
695696 AbortSignal signal;
696697 };
697698 </pre>
@@ -700,6 +701,11 @@ spec:css-syntax-3;
700701 :: This property specifies the mediation requirements for a given credential request. The
701702 meaning of each enum value is described below in {{CredentialMediationRequirement}} .
702703 Processing details are defined in [[#algorithm-request]] .
704+ : <dfn>uiMode</dfn>
705+ :: This property specifies the user interface mode for a given credential request, when
706+ the user agent performs [=user mediation=] . The meaning of each value
707+ is described below in {{CredentialUiMode}} . Processing details are defined in
708+ [[#algorithm-request]] .
703709 : <dfn>signal</dfn>
704710 :: This property lets the developer abort an ongoing {{CredentialsContainer/get()}} operation.
705711 An aborted operation may complete normally (generally if the abort was received after the
@@ -836,11 +842,49 @@ spec:css-syntax-3;
836842 origin. To set that flag, developers should call {{preventSilentAccess()}} .
837843 </div>
838844
845+ ### UI Mode ### {#ui-mode}
846+
847+ When making a request via {{get(options)}} , developers can indicate a desired [=user mediation=] mode
848+ by choosing the appropriate {{CredentialUiMode}} enum value.
849+
850+ The UI Mode field has no default value. When unspecified, the
851+ `[[DiscoverFromExternalSource]] (origin, options, sameOriginWithAncestors)` method must consider
852+ {{CredentialMediationRequirement}} on its own in order to specify user agent behavior.
853+
854+ Note: This allows callers to distinguish between different available forms of [=user mediation=] , when [=user mediation=] occurs.
855+ Whether or not UI is shown depends on the value of {{CredentialMediationRequirement}} for the request. Not all values of
856+ {{CredentialUiMode}} make sense in combination with all values of {{CredentialMediationRequirement}} , and the
857+ interaction depends on the `[[DiscoverFromExternalSource]] (origin, options, sameOriginWithAncestors)` methods for credential
858+ types that support it.
859+
860+ <pre class="idl">
861+ enum CredentialUiMode {
862+ "immediate"
863+ };
864+ </pre>
865+ <div dfn-for="CredentialUiMode" dfn-type="enum-value">
866+ : <dfn>immediate</dfn>
867+ :: On an invocation to {{CredentialsContainer/get()}} , the user agent will either show a modal credential selection
868+ dialog to the user, or the operation will immediately complete without providing credentials.
869+
870+ This provides the ability for simplified sign-in UI to be shown to the user, or else the website can take an
871+ alternative action, such as showing its own sign-in page or continuing a non-signed-in user journey.
872+
873+ If no credentials are available to be displayed in a credential selection dialog, [=user mediation=]
874+ will be skipped without, for instance, prompting the user to provide a credential.
875+
876+ Note: This specification does not provide a static method similar to
877+ {{Credential/isConditionalMediationAvailable()}} to detect feature availability for {{CredentialUiMode/immediate}} .
878+ In the future, if this mediation mode is expanded to include other credential types, a more general
879+ approach to feature detection will be needed that can indicate which credential types are
880+ supported under a given combination of {{CredentialMediationRequirement}} and {{CredentialUiMode}} values.
881+ </div>
882+
839883 #### Examples #### {#mediation-examples}
840884
841885 <div class="example" id="example-mediation-silent">
842886 MegaCorp, Inc. wishes to seamlessly sign in users when possible. They can do so by calling
843- {{get()}} for all non-signed in users at some convinient point while a landing page is loading,
887+ {{get()}} for all non-signed in users at some convenient point while a landing page is loading,
844888 passing in a {{CredentialRequestOptions/mediation}} member set to
845889 "{{CredentialMediationRequirement/silent}} ". This ensures that users who have opted-into
846890 dropping the requirements for user mediation (as described in [[#user-mediation-requirement]] )
@@ -863,7 +907,7 @@ spec:css-syntax-3;
863907 <div class="example" id="example-mediation-optional">
864908 When a user clicks "Sign In", MegaCorp, Inc. wishes to give them the smoothest possible
865909 experience. If they have [[#user-mediation-requirement|opted-into]] signing in without
866- [=user mediation=] , and the user agent can unambigiously choose a credential, great! If
910+ [=user mediation=] , and the user agent can unambiguously choose a credential, great! If
867911 not, a [=credential chooser=] will be presented.
868912
869913 <pre>
@@ -958,7 +1002,7 @@ spec:css-syntax-3;
9581002
9591003 The <dfn abstract-op>Request a `Credential`</dfn> algorithm accepts a {{CredentialRequestOptions}}
9601004 (|options|), and returns a {{Promise}} that resolves with a {{Credential}} if one can be
961- unambigiously obtained, or with `null` if not.
1005+ unambiguously obtained, or with `null` if not.
9621006
9631007 <ol class="algorithm">
9641008 1. Let |settings| be the [=current settings object=] .
@@ -987,6 +1031,12 @@ spec:css-syntax-3;
9871031 [=user mediation=] , return [=a promise rejected with=]
9881032 a "{{TypeError}} " {{DOMException}} .
9891033
1034+ 1. If |options|.{{CredentialRequestOptions/uiMode}} is
1035+ {{CredentialUiMode/immediate}} and |interface| does
1036+ not support {{CredentialUiMode/immediate}}
1037+ [=user mediation=] , return [=a promise rejected with=]
1038+ a "{{TypeError}} " {{DOMException}} .
1039+
9901040 1. If |settings|' [=active credential types=] [=set/contains=] |interface|' s
9911041 {{Credential/[[type]]}} , return [=a promise rejected with=] a "{{NotAllowedError}} "
9921042 {{DOMException}} .
0 commit comments