diff --git a/e2e/aniimo.spec.js b/e2e/aniimo.spec.js index fe9ddb5..061c079 100644 --- a/e2e/aniimo.spec.js +++ b/e2e/aniimo.spec.js @@ -101,11 +101,11 @@ test("Aniimo matches MHW card motion, surfaces and filter controls", async ({ pa await expect(card).toBeVisible(); expect(await styles(card.locator(".aniimo-card-inner"), motionProperties)).toEqual(motion); expect(await styles(card.locator(".aniimo-front"), faceProperties)).toEqual(face); - expect(await styles(card.locator(".aniimo-front .aniimo-flip"), indicatorProperties)).toEqual(indicator); + expect(await styles(card.locator(".aniimo-card > .aniimo-flip"), indicatorProperties)).toEqual(indicator); expect(await styles(page.locator(".filter-logic").first(), filterProperties)).toEqual(filter); await page.keyboard.press("Escape"); - await expect(card.locator(".aniimo-face .aniimo-flip")).toHaveCount(2); - await expect(card.locator(".aniimo-card > .aniimo-flip")).toHaveCount(0); + await expect(card.locator(".aniimo-face .aniimo-flip")).toHaveCount(0); + await expect(card.locator(".aniimo-card > .aniimo-flip")).toHaveCount(1); await card.getByRole("button", { name: /Afficher les capacités/ }).press("Enter"); await expect(card.getByRole("button", { name: /Afficher le portrait/ })).toBeFocused(); await expect(card.locator(".aniimo-front")).toHaveAttribute("inert", ""); diff --git a/website/src/features/games/aniimo/AniimoCard.jsx b/website/src/features/games/aniimo/AniimoCard.jsx index 3539a78..2692baf 100644 --- a/website/src/features/games/aniimo/AniimoCard.jsx +++ b/website/src/features/games/aniimo/AniimoCard.jsx @@ -1,5 +1,5 @@ // Rôle : affiche une carte Aniimo retournable et les onglets des variantes correspondantes. -import { useId, useLayoutEffect, useRef, useState } from "react"; +import { useId, useState } from "react"; import { GuideChecklistCheckbox, GuideChecklistMark } from "../GuideChecklistControls.jsx"; import { Icon } from "../../../components/Icon.jsx"; import { Tooltip } from "../../../components/Tooltip.jsx"; @@ -18,24 +18,11 @@ function shortForm(label) { function CardFaces({ variant, t, content, checklist, statsMax }) { const completed = checklist.isCompleted(variant.key); const [flipped, setFlipped] = useState(false); - const frontButton = useRef(null); - const backButton = useRef(null); - const focusAfterFlip = useRef(false); - useLayoutEffect(() => { - if (!focusAfterFlip.current) return; - (flipped ? backButton : frontButton).current?.focus({ preventScroll: true }); - focusAfterFlip.current = false; - }, [flipped]); - function flip() { - focusAfterFlip.current = true; - setFlipped((value) => !value); - } - const flipButton = (back, ref) => ; return (