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 dashboard tab list items having role="button" instead of role="tab" (#70546) (#70976)
Anderson6b241a18fd4c
diff --git a/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.tsx b/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.tsxindex 8855e0ce9b5..c9ad1bd37fe 100644--- a/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.tsx+++ b/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.tsx@@ -134,7 +134,12 @@ export function DashboardTabs() {/>) : (tabs.map((tab) => (- <Sortable key={tab.id} id={tab.id} disabled={!isEditing}>+ <Sortable+ key={tab.id}+ id={tab.id}+ disabled={!isEditing}+ role="presentation"+ ><TabButton.Renameablevalue={tab.id}label={tab.name}diff --git a/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.unit.spec.tsx b/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.unit.spec.tsxindex 0f10a71804f..987209ca4e5 100644--- a/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.unit.spec.tsx+++ b/frontend/src/metabase/dashboard/components/DashboardTabs/DashboardTabs.unit.spec.tsx@@ -8,7 +8,7 @@ import {withRouter,} from "react-router";-import { renderWithProviders, screen } from "__support__/ui";+import { renderWithProviders, screen, within } from "__support__/ui";import { INPUT_WRAPPER_TEST_ID } from "metabase/common/components/TabButton";import { getDefaultTab, resetTempTabId } from "metabase/dashboard/actions";import { useDashboardUrlQuery } from "metabase/dashboard/hooks/use-dashboard-url-query";@@ -204,6 +204,26 @@ describe("DashboardTabs", () => {expect(queryTab(2)).toBeVisible();});+ it("should use role=tab on tab items and role=tablist on the container (#70546)", () => {+ setup({+ isEditing: false,+ tabs: [+ getDefaultTab({ tabId: 1, dashId: 1, name: "Tab 1" }),+ getDefaultTab({ tabId: 2, dashId: 1, name: "Tab 2" }),+ ],+ });++ const tablist = screen.getByRole("tablist");+ expect(tablist).toBeInTheDocument();++ expect(+ within(tablist).getByRole("tab", { name: "Tab 1" }),+ ).toBeInTheDocument();+ expect(+ within(tablist).getByRole("tab", { name: "Tab 2" }),+ ).toBeInTheDocument();+ });+it("should not display tabs when there is one", () => {setup({isEditing: false,