Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement focus management for Two-Step Verification slideouts, hide decorative success checkmark, add accName to Actions button #15229

Merged
merged 6 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Release Notes for Craft CMS 5.3 (WIP)

### Content Management

- “Replace file” actions now display success notices on complete. ([#15217](https://github.com/craftcms/cms/issues/15217))

### Accessibility
- Improved the accessibility of two-step verification setup. ([#15229](https://github.com/craftcms/cms/pull/15229))
5 changes: 4 additions & 1 deletion src/templates/users/_auth-methods.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
} %}
{% for method in craft.app.auth.getAvailableMethods() %}
{% set isActive = method.isActive() %}
{% set headingId = "auth-method-heading-#{loop.index0}" %}

{% tag 'div' with {
class: 'auth-method',
Expand All @@ -15,7 +16,7 @@
},
} %}
<div class="auth-method-details">
<h3>{{ method.displayName() }}</h3>
<h3 id="{{ headingId }}">{{ method.displayName() }}</h3>
<div class="instructions">
{{ method.description() }}
</div>
Expand All @@ -42,6 +43,8 @@
buttonAttributes: {
class: ['auth-method-action-btn', 'action-btn', 'hairline'],
title: 'Actions'|t('app'),
'aria-label': 'Actions'|t('app'),
'aria-describedby': headingId,
},
}) }}
</div>
Expand Down
8 changes: 4 additions & 4 deletions src/templates/users/_passkeys-table.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<table class="data fullwidth">
<thead>
<tr>
<th>{{ 'Name'|t('app') }}</th>
<th>{{ 'Last Used'|t('app') }}</th>
<td></td>
<th scope="col">{{ 'Name'|t('app') }}</th>
<th scope="col">{{ 'Last Used'|t('app') }}</th>
<th scope="col"><span class="visually-hidden">{{ 'Actions'|t('app') }}</span></th>
</tr>
</thead>
<tbody>
{% for passkey in passkeys %}
<tr>
<td data-name="credentialName">{{ passkey.credentialName }}</td>
<th scope="row" data-name="credentialName">{{ passkey.credentialName }}</th>
<td>{{ passkey.dateLastUsed|timestamp }}</td>
<td>
{{ tag('a', {
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/authmethodsetup/dist/auth.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/authmethodsetup/dist/auth.js.map

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions src/web/assets/authmethodsetup/src/AuthMethodSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Craft.AuthMethodSetup = Garnish.Base.extend(
});
},

focusMethodButton(method) {
this.methodListings[method].querySelector('button').focus();
},

showSetupSlideout(method) {
const button = this.methodListings[method].querySelector(
'.auth-method-setup-btn'
Expand All @@ -54,6 +58,7 @@ Craft.AuthMethodSetup = Garnish.Base.extend(
'activate',
() => {
slideout.close();
this.focusMethodButton(method);
}
);

Expand Down Expand Up @@ -138,9 +143,11 @@ Craft.AuthMethodSetup.Slideout = Craft.Slideout.extend({
});
this.$container.find('.so-body').addClass('auth-method-setup-success')
.html(`
<div class="auth-method-setup-success-graphic" data-icon="check"></div>
<h1 class="auth-method-setup-success-message">${message}</h1>
`);
<div class="auth-method-setup-success-graphic" data-icon="check" aria-hidden="true"></div>
<h1 class="auth-method-setup-success-message" tabindex="-1">${message}</h1>
`);

this.$container.find('.auth-method-setup-success-message').focus();
this.$container
.find('.auth-method-close-btn')
.text(Craft.t('app', 'Close'));
Expand Down