Skip to content

Commit 2706f0d

Browse files
committed
fix: trigger state change when canceling conditional autocomplete
1 parent d61caf7 commit 2706f0d

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

app.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,21 @@ async function createOrReplacePublicKey(event) {
298298
// excludeCredentials: [ { type: 'public-key', id: 'base64id' }]
299299
pubkeyRegOpts.publicKey.excludeCredentials = [];
300300

301-
await setPasskey(pubkeyRegOpts).catch(catchUiError);
301+
if (currentMediation === "conditional") {
302+
// by selecting explicit register we're canceling the
303+
// conditional state and should trigger the UI to update to match
304+
let $mediation = $('select[name="mediation"]');
305+
//@ts-ignore
306+
$mediation.value = "optional";
307+
//@ts-ignore
308+
$mediation.onchange();
309+
}
310+
await setPasskey(pubkeyRegOpts)
311+
.then(function () {
312+
//@ts-ignore
313+
$("input[name=username]").value = "";
314+
})
315+
.catch(catchUiError);
302316
}
303317

304318
/**

0 commit comments

Comments
 (0)