Skip to content

Commit

Permalink
Only add live region to form button if there are messages attached to…
Browse files Browse the repository at this point in the history
… the button; add loading message on add passkey click
  • Loading branch information
Lupe Camacho authored and Lupe Camacho committed Aug 20, 2024
1 parent 556e652 commit 028a8d6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/templates/_includes/forms/button.twig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{% set failureMessage = failureMessage ?? false %}
{% set retryMessage = retryMessage ?? false %}
{% set successMessage = successMessage ?? false %}
{% set enableLiveRegion = busyMessage or failureMessage or retryMessage or successMessage %}
{% set label = label ?? null %}
{% set labelHtml = labelHtml ?? null %}
{% set attributes = {
Expand All @@ -22,7 +23,7 @@
}|merge(attributes ?? {}) -%}

{% apply spaceless %}
{% if spinner %}
{% if spinner and enableLiveRegion %}
<div role="status" class="visually-hidden"></div>
{% endif %}
{% tag 'button' with attributes %}
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/passkeysetup/dist/PasskeySetup.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/passkeysetup/dist/PasskeySetup.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/web/assets/passkeysetup/src/PasskeySetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Craft.PasskeySetup = Garnish.Base.extend({
}

this.$addPasskeyBtn.addClass('loading');
Craft.cp.announce(Craft.t('app', 'Loading'));

try {
await (() =>
Expand Down

0 comments on commit 028a8d6

Please sign in to comment.