The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Fix nested button DOM nesting in StepperWithCards (#70667)
Nicolò Pretto2fa8abc24793
diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsxindex d801cb50a1d..2d8829a2f05 100644--- a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.tsx@@ -97,7 +97,7 @@ export const StepperWithCards = ({ steps }: { steps: StepperStep[] }) => {<Grid>{step.cards.map((card) => {const onClick =- card.clickAction?.type === "click"+ card.clickAction?.type === "click" && !card.locked? card.clickAction.onClick: undefined;@@ -116,9 +116,8 @@ export const StepperWithCards = ({ steps }: { steps: StepperStep[] }) => {[S.lockedStepCard]: card.locked,[S.nextStepCard]: isNextCard,})}- component={onClick ? "button" : undefined}onClick={onClick}- disabled={card.locked}+ aria-disabled={card.locked}data-testid={`step-card-${card.id}`}data-next-step={isNextCard}>diff --git a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsxindex 30c859736b3..bca00393d7c 100644--- a/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx+++ b/frontend/src/metabase/embedding/embedding-hub/components/StepperWithCards/StepperWithCards.unit.spec.tsx@@ -134,7 +134,7 @@ describe("StepperWithCards", () => {// The locked card should be disabledconst lockedCard = screen.getByTestId("step-card-2");- expect(lockedCard).toBeDisabled();+ expect(lockedCard).toHaveAttribute("aria-disabled", "true");// Clicking the disabled card should not trigger the actionawait userEvent.click(lockedCard);@@ -142,7 +142,7 @@ describe("StepperWithCards", () => {// The step should not be marked as doneconst allSteps = screen.getAllByRole("button");- expect(allSteps).toHaveLength(2);+ expect(allSteps).toHaveLength(1);expect(allSteps[0]).toHaveAttribute("data-done", "false");// No steps should be marked as done