Skip to content

Commit

Permalink
[FEATURE] Faire une passe sur l'accessibilité pour l'élément Flashcar…
Browse files Browse the repository at this point in the history
  • Loading branch information
pix-service-auto-merge authored Nov 19, 2024
2 parents 0fb0ec0 + b0e1a6c commit d45b3ff
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@
box-shadow: 0 12px 24px 0 rgb(7 20 46 / 12%);
}

/* To get higher specifity than `.modulix-passage h3` we double classes usage */
.element-flashcards-intro-card {
.element-flashcards-intro-card {
&__title {
@extend %pix-title-s;
}
}
}

.element-flashcards-card {
&__content {
display: flex;
Expand Down
15 changes: 15 additions & 0 deletions mon-pix/app/components/module/element/flashcards/_flashcards.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@
&:active {
background: var(--pix-error-100);
}

&:focus,
&:focus-visible {
outline: var(--pix-error-500) solid var(--button-border-size-hover);
}
}

&--almost {
Expand All @@ -105,6 +110,11 @@
&:active {
background: var(--pix-warning-100);
}

&:focus,
&:focus-visible {
outline: var(--pix-warning-900) solid var(--button-border-size-hover);
}
}

&--yes {
Expand All @@ -122,6 +132,11 @@
&:active {
background: var(--pix-success-100);
}

&:focus,
&:focus-visible {
outline: var(--pix-success-700) solid var(--button-border-size-hover);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import { t } from 'ember-intl';
</div>
{{/if}}

<div class="element-flashcards-intro-card__text">
<p class="element-flashcards-intro-card__title">{{@title}}</p>
</div>
<h3 class="element-flashcards-intro-card__title">{{@title}}</h3>

<div class="element-flashcards-intro-card__footer">
<PixButton @triggerAction={{@onStart}} @variant="primary" @size="small">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ export default class ModulixFlashcards extends Component {
this.args.onSelfAssessment(selfAssessmentData);
this.incrementCounterFor(userAssessment);
this.goToNextCard();

const elementToFocus = document.querySelector('.element-flashcards');
elementToFocus.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'start' });
}

<template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module('Integration | Component | Module | Flashcards Intro Card', function (hoo
);

// then
assert.ok(screen.getByText('Introduction à la poésie'));
assert.ok(screen.getByRole('heading', { name: 'Introduction à la poésie' }));
assert.strictEqual(
screen.getByRole('presentation').getAttribute('src'),
'https://images.pix.fr/modulix/bien-ecrire-son-adresse-mail-explication-les-parties-dune-adresse-mail.svg',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module('Integration | Component | Module | Flashcards', function (hooks) {
const screen = await render(<template><ModulixFlashcards @flashcards={{flashcards}} /></template>);

// then
assert.ok(screen.getByText("Introduction à l'adresse e-mail"));
assert.ok(screen.getByRole('heading', { name: "Introduction à l'adresse e-mail" }));
assert.strictEqual(
screen.getByRole('presentation').getAttribute('src'),
'https://images.pix.fr/modulix/flashcards-intro.png',
Expand Down

0 comments on commit d45b3ff

Please sign in to comment.