Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Wrap long question or dashboard names (#62980)

Romeo Van Snickb53b8411c42f
diff --git a/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js b/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js
index de13e85b109..098a3be732b 100644
--- a/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js
+++ b/e2e/test/scenarios/dashboard/dashboard-reproductions.cy.spec.js
@@ -2154,3 +2154,29 @@ describe("issue 52674", () => {
H.popover().should("be.visible");
});
});
+
+describe("issue 53370", () => {
+ const LONG_NAME = "a".repeat(254);
+
+ beforeEach(() => {
+ H.restore();
+ cy.signInAsNormalUser();
+
+ H.createDashboard({
+ name: LONG_NAME,
+ }).then(({ body: dashboard }) => {
+ H.visitDashboard(dashboard.id);
+ });
+ });
+
+ it("should wrap long dashboard named (metabase#53370)", () => {
+ cy.findByDisplayValue(LONG_NAME)
+ .should("be.visible")
+ .then(($el) => {
+ cy.window().then((win) => {
+ cy.wrap($el[0].offsetWidth).should("be.lt", win.innerWidth);
+ });
+ });
+ //
+ });
+});
diff --git a/e2e/test/scenarios/question-reproductions/reproductions.cy.spec.ts b/e2e/test/scenarios/question-reproductions/reproductions.cy.spec.ts
index b9f76be3a2a..d3e4393a77d 100644
--- a/e2e/test/scenarios/question-reproductions/reproductions.cy.spec.ts
+++ b/e2e/test/scenarios/question-reproductions/reproductions.cy.spec.ts
@@ -1174,3 +1174,31 @@ describe("issue 58628", () => {
H.queryBuilderHeader().should("be.visible");
});
});
+
+describe("issue 52872", () => {
+ const LONG_NAME = "a".repeat(254);
+
+ beforeEach(() => {
+ H.restore();
+ cy.signInAsNormalUser();
+ H.createQuestion(
+ {
+ name: LONG_NAME,
+ query: {
+ "source-table": ORDERS_ID,
+ },
+ },
+ { visitQuestion: true },
+ );
+ });
+
+ it("Saved questions with a very long title should wrap (metabse#52872)", () => {
+ cy.findByDisplayValue(LONG_NAME)
+ .should("be.visible")
+ .then(($el) => {
+ cy.window().then((window) => {
+ cy.wrap($el[0].offsetWidth).should("be.lt", window.innerWidth);
+ });
+ });
+ });
+});
diff --git a/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderView.module.css b/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderView.module.css
index e25c896b568..6fc55dc2202 100644
--- a/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderView.module.css
+++ b/frontend/src/metabase/dashboard/components/DashboardHeader/DashboardHeaderView.module.css
@@ -85,6 +85,8 @@
.HeaderContent {
padding-top: 1rem;
padding-bottom: 0.75rem;
+ width: 100%;
+ min-width: 0;
.HeaderCaptionContainer {
top: 10px;
@@ -125,6 +127,8 @@
font-size: 1.25rem;
font-weight: 700;
line-height: 1.5rem;
+ width: 100%;
+ overflow-wrap: break-word;
}
.HeaderRow {
diff --git a/frontend/src/metabase/query_builder/components/SavedQuestionHeaderButton/SavedQuestionHeaderButton.module.css b/frontend/src/metabase/query_builder/components/SavedQuestionHeaderButton/SavedQuestionHeaderButton.module.css
index c143f51f4c6..986ed4e60d9 100644
--- a/frontend/src/metabase/query_builder/components/SavedQuestionHeaderButton/SavedQuestionHeaderButton.module.css
+++ b/frontend/src/metabase/query_builder/components/SavedQuestionHeaderButton/SavedQuestionHeaderButton.module.css
@@ -1,5 +1,11 @@
+.HeaderTitleContainer {
+ width: 100%;
+ min-width: 0;
+}
+
.HeaderTitle {
font-size: 1.25rem;
font-weight: 700;
line-height: 1.5rem;
+ width: 100%;
}
diff --git a/frontend/src/metabase/query_builder/components/SavedQuestionHeaderButton/SavedQuestionHeaderButton.tsx b/frontend/src/metabase/query_builder/components/SavedQuestionHeaderButton/SavedQuestionHeaderButton.tsx
index 27515a7e44b..1f60362c49d 100644
--- a/frontend/src/metabase/query_builder/components/SavedQuestionHeaderButton/SavedQuestionHeaderButton.tsx
+++ b/frontend/src/metabase/query_builder/components/SavedQuestionHeaderButton/SavedQuestionHeaderButton.tsx
@@ -18,7 +18,11 @@ function SavedQuestionHeaderButton({
onSave,
}: SavedQuestionHeaderButtonProps) {
return (
- <Flex align="center" gap="0.25rem">
+ <Flex
+ align="center"
+ gap="0.25rem"
+ className={SavedQuestionHeaderButtonS.HeaderTitleContainer}
+ >
<EditableText
className={SavedQuestionHeaderButtonS.HeaderTitle}
isDisabled={!question.canWrite() || question.isArchived()}
diff --git a/frontend/src/metabase/query_builder/components/view/ViewHeader/ViewTitleHeader.module.css b/frontend/src/metabase/query_builder/components/view/ViewHeader/ViewTitleHeader.module.css
index 6bfa9a1911b..6d13bb28ec3 100644
--- a/frontend/src/metabase/query_builder/components/view/ViewHeader/ViewTitleHeader.module.css
+++ b/frontend/src/metabase/query_builder/components/view/ViewHeader/ViewTitleHeader.module.css
@@ -185,6 +185,7 @@
.SavedQuestionHeaderButtonContainer {
right: 0.38rem;
+ width: 100%;
&.isModelOrMetric {
right: 0;
@@ -192,6 +193,9 @@
}
.SavedQuestionLeftSideRoot {
+ width: 100%;
+ min-width: 0;
+
.SavedQuestionHeaderButtonContainer {
transition: all 400ms ease;
position: relative;
diff --git a/frontend/src/metabase/query_builder/components/view/ViewHeader/components/HeaderBreadcrumbs/HeaderBreadcrumbs.module.css b/frontend/src/metabase/query_builder/components/view/ViewHeader/components/HeaderBreadcrumbs/HeaderBreadcrumbs.module.css
index 535b3da2195..4f3f1ef40da 100644
--- a/frontend/src/metabase/query_builder/components/view/ViewHeader/components/HeaderBreadcrumbs/HeaderBreadcrumbs.module.css
+++ b/frontend/src/metabase/query_builder/components/view/ViewHeader/components/HeaderBreadcrumbs/HeaderBreadcrumbs.module.css
@@ -1,4 +1,6 @@
.Container {
+ max-width: 100%;
+
&.headVariant {
.HeaderBadge {
font-size: 1.25rem;