Переглянути джерело

fix(theming): Add `aria-pressed` attribute to active background

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
tags/v28.0.0beta1
Ferdinand Thiessen 7 місяці тому
джерело
коміт
8d57cdcab5
Аккаунт користувача з таким Email не знайдено

+ 4
- 2
apps/theming/src/UserThemes.vue Переглянути файл

@@ -26,7 +26,9 @@
<NcSettingsSection :name="t('theming', 'Appearance and accessibility')"
:limit-width="false"
class="theming">
<!-- eslint-disable-next-line vue/no-v-html -->
<p v-html="description" />
<!-- eslint-disable-next-line vue/no-v-html -->
<p v-html="descriptionDetail" />

<div class="theming__preview-list">
@@ -133,7 +135,7 @@ export default {
// using the `t` replace method escape html, we have to do it manually :/
return t(
'theming',
'Universal access is very important to us. We follow web standards and check to make everything usable also without mouse, and assistive software such as screenreaders. We aim to be compliant with the {guidelines}Web Content Accessibility Guidelines{linkend} 2.1 on AA level, with the high contrast theme even on AAA level.'
'Universal access is very important to us. We follow web standards and check to make everything usable also without mouse, and assistive software such as screenreaders. We aim to be compliant with the {guidelines}Web Content Accessibility Guidelines{linkend} 2.1 on AA level, with the high contrast theme even on AAA level.',
)
.replace('{guidelines}', this.guidelinesLink)
.replace('{linkend}', '</a>')
@@ -146,7 +148,7 @@ export default {
descriptionDetail() {
return t(
'theming',
'If you find any issues, do not hesitate to report them on {issuetracker}our issue tracker{linkend}. And if you want to get involved, come join {designteam}our design team{linkend}!'
'If you find any issues, do not hesitate to report them on {issuetracker}our issue tracker{linkend}. And if you want to get involved, come join {designteam}our design team{linkend}!',
)
.replace('{issuetracker}', this.issuetrackerLink)
.replace('{designteam}', this.designteamLink)

+ 23
- 8
apps/theming/src/components/BackgroundSettings.vue Переглянути файл

@@ -26,8 +26,12 @@
<template>
<div class="background-selector" data-user-theming-background-settings>
<!-- Custom background -->
<button class="background background__filepicker"
:class="{ 'icon-loading': loading === 'custom', 'background--active': backgroundImage === 'custom' }"
<button :aria-pressed="backgroundImage === 'custom'"
:class="{
'icon-loading': loading === 'custom',
'background background__filepicker': true,
'background--active': backgroundImage === 'custom'
}"
:data-color-bright="invertTextColor(Theming.color)"
data-user-theming-background-custom
tabindex="0"
@@ -38,8 +42,12 @@
</button>

<!-- Default background -->
<button class="background background__default"
:class="{ 'icon-loading': loading === 'default', 'background--active': backgroundImage === 'default' }"
<button :aria-pressed="backgroundImage === 'default'"
:class="{
'icon-loading': loading === 'default',
'background background__default': true,
'background--active': backgroundImage === 'default'
}"
:data-color-bright="invertTextColor(Theming.defaultColor)"
:style="{ '--border-color': Theming.defaultColor }"
data-user-theming-background-default
@@ -62,8 +70,11 @@
</NcColorPicker>

<!-- Remove background -->
<button class="background background__delete"
:class="{ 'background--active': isBackgroundDisabled }"
<button :aria-pressed="isBackgroundDisabled"
:class="{
'background background__delete': true,
'background--active': isBackgroundDisabled
}"
data-user-theming-background-clear
tabindex="0"
@click="removeBackground">
@@ -77,11 +88,15 @@
:key="shippedBackground.name"
:title="shippedBackground.details.attribution"
:aria-label="shippedBackground.details.attribution"
:class="{ 'icon-loading': loading === shippedBackground.name, 'background--active': backgroundImage === shippedBackground.name }"
:aria-pressed="backgroundImage === shippedBackground.name"
:class="{
'background background__shipped': true,
'icon-loading': loading === shippedBackground.name,
'background--active': backgroundImage === shippedBackground.name
}"
:data-color-bright="shippedBackground.details.theming === 'dark'"
:data-user-theming-background-shipped="shippedBackground.name"
:style="{ backgroundImage: 'url(' + shippedBackground.preview + ')', '--border-color': shippedBackground.details.primary_color }"
class="background background__shipped"
tabindex="0"
@click="setShipped(shippedBackground.name)">
<Check :size="44" />

+ 29
- 7
cypress/e2e/theming/user-background.cy.ts Переглянути файл

@@ -38,7 +38,8 @@ describe('User default background settings', function() {

it('See the user background settings', function() {
cy.visit('/settings/user/theming')
cy.get('[data-user-theming-background-settings]').scrollIntoView().should('be.visible')
cy.get('[data-user-theming-background-settings]').scrollIntoView()
cy.get('[data-user-theming-background-settings]').should('be.visible')
})

// Default cloud background is not rendered if admin theming background remains unchanged
@@ -50,6 +51,10 @@ describe('User default background settings', function() {
cy.get('[data-user-theming-background-default]').should('be.visible')
cy.get('[data-user-theming-background-default]').should('have.class', 'background--active')
})

it('Default background has accessibility attribute set', function() {
cy.get('[data-user-theming-background-default]').should('have.attr', 'aria-pressed', 'true')
})
})

describe('User select shipped backgrounds and remove background', function() {
@@ -61,7 +66,8 @@ describe('User select shipped backgrounds and remove background', function() {

it('See the user background settings', function() {
cy.visit('/settings/user/theming')
cy.get('[data-user-theming-background-settings]').scrollIntoView().should('be.visible')
cy.get('[data-user-theming-background-settings]').scrollIntoView()
cy.get('[data-user-theming-background-settings]').should('be.visible')
})

it('Select a shipped background', function() {
@@ -71,6 +77,9 @@ describe('User select shipped backgrounds and remove background', function() {
// Select background
cy.get(`[data-user-theming-background-shipped="${background}"]`).click()

// Set the accessibility state
cy.get(`[data-user-theming-background-shipped="${background}"]`).should('have.attr', 'aria-pressed', 'true')

// Validate changed background and primary
cy.wait('@setBackground')
cy.waitUntil(() => validateBodyThemingCss('#a53c17', background))
@@ -83,9 +92,12 @@ describe('User select shipped backgrounds and remove background', function() {
// Select background
cy.get(`[data-user-theming-background-shipped="${background}"]`).click()

// Set the accessibility state
cy.get(`[data-user-theming-background-shipped="${background}"]`).should('have.attr', 'aria-pressed', 'true')

// Validate changed background and primary
cy.wait('@setBackground')
cy.waitUntil(() => validateBodyThemingCss('#56633d', background, true))
cy.waitUntil(() => validateBodyThemingCss('#56633d', background))
})

it('Remove background', function() {
@@ -94,6 +106,9 @@ describe('User select shipped backgrounds and remove background', function() {
// Clear background
cy.get('[data-user-theming-background-clear]').click()

// Set the accessibility state
cy.get('[data-user-theming-background-clear]').should('have.attr', 'aria-pressed', 'true')

// Validate clear background
cy.wait('@clearBackground')
cy.waitUntil(() => validateBodyThemingCss('#56633d', ''))
@@ -109,7 +124,8 @@ describe('User select a custom color', function() {

it('See the user background settings', function() {
cy.visit('/settings/user/theming')
cy.get('[data-user-theming-background-settings]').scrollIntoView().should('be.visible')
cy.get('[data-user-theming-background-settings]').scrollIntoView()
cy.get('[data-user-theming-background-settings]').should('be.visible')
})

it('Select a custom color', function() {
@@ -135,7 +151,8 @@ describe('User select a bright custom color and remove background', function() {

it('See the user background settings', function() {
cy.visit('/settings/user/theming')
cy.get('[data-user-theming-background-settings]').scrollIntoView().should('be.visible')
cy.get('[data-user-theming-background-settings]').scrollIntoView()
cy.get('[data-user-theming-background-settings]').should('be.visible')
})

it('Remove background', function() {
@@ -204,7 +221,8 @@ describe('User select a custom background', function() {

it('See the user background settings', function() {
cy.visit('/settings/user/theming')
cy.get('[data-user-theming-background-settings]').scrollIntoView().should('be.visible')
cy.get('[data-user-theming-background-settings]').scrollIntoView()
cy.get('[data-user-theming-background-settings]').should('be.visible')
})

it('Select a custom background', function() {
@@ -243,7 +261,8 @@ describe('User changes settings and reload the page', function() {

it('See the user background settings', function() {
cy.visit('/settings/user/theming')
cy.get('[data-user-theming-background-settings]').scrollIntoView().should('be.visible')
cy.get('[data-user-theming-background-settings]').scrollIntoView()
cy.get('[data-user-theming-background-settings]').should('be.visible')
})

it('Select a custom background', function() {
@@ -283,5 +302,8 @@ describe('User changes settings and reload the page', function() {
it('Reload the page and validate persistent changes', function() {
cy.reload()
cy.waitUntil(() => validateBodyThemingCss(selectedColor, 'apps/theming/background?v='))

// validate accessibility state
cy.get('[data-user-theming-background-custom]').should('have.attr', 'aria-pressed', 'true')
})
})

+ 2
- 2
dist/614-614.js
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 1
- 1
dist/614-614.js.map
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 2
- 2
dist/core-unsupported-browser.js
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 1
- 1
dist/core-unsupported-browser.js.map
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 2
- 2
dist/theming-personal-theming.js
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 1
- 1
dist/theming-personal-theming.js.map
Різницю між файлами не показано, бо вона завелика
Переглянути файл


Завантаження…
Відмінити
Зберегти