Skip to content

Commit 85daf90

Browse files
authored
fix(feedback): Fix non-wrapping form title (#14355)
Fixes an issue with long form titles causing the width of the dialog to expand. Instead, apply the css var `--form-width` to the dialog contents so that the title wraps. After: <img width="323" alt="image" src="https://github.com/user-attachments/assets/b2982b72-e9df-4459-8241-4b47f2fdd4fe"> <img width="558" alt="image" src="https://github.com/user-attachments/assets/cd4a2285-7088-4bc1-b628-9672861a71f2"> Single line: <img width="344" alt="image" src="https://github.com/user-attachments/assets/1661ca0d-8cea-435c-86a8-cc56913d0483"> Closes #14351
1 parent 138417b commit 85daf90

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

packages/feedback/src/modal/components/Dialog.css.ts

+13-10
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const DIALOG = `
6060
gap: 16px;
6161
padding: var(--dialog-padding, 24px);
6262
max-width: 100%;
63-
width: 100%;
63+
width: var(--form-width, 272px);
6464
max-height: 100%;
6565
overflow: auto;
6666
@@ -71,17 +71,26 @@ const DIALOG = `
7171
transform: translate(0, 0) scale(1);
7272
transition: transform 0.2s ease-in-out;
7373
}
74+
75+
@media (max-width: 600px) {
76+
.dialog__content {
77+
width: var(--form-width, 100%);
78+
}
79+
}
80+
7481
`;
7582

7683
const DIALOG_HEADER = `
7784
.dialog__header {
7885
display: flex;
79-
align-items: center;
86+
gap: 4px;
8087
justify-content: space-between;
8188
font-weight: var(--dialog-header-weight, 600);
8289
margin: 0;
8390
}
84-
91+
.dialog__title {
92+
align-self: center;
93+
}
8594
.brand-link {
8695
display: inline-flex;
8796
}
@@ -101,18 +110,12 @@ const FORM = `
101110
102111
.form__right {
103112
flex: 0 0 auto;
104-
width: var(--form-width, 272px);
105113
display: flex;
106114
overflow: auto;
107115
flex-direction: column;
108116
justify-content: space-between;
109117
gap: 20px;
110-
}
111-
112-
@media (max-width: 600px) {
113-
.form__right {
114-
width: var(--form-width, 100%);
115-
}
118+
width: 100%;
116119
}
117120
118121
.form__top {

packages/feedback/src/modal/components/DialogHeader.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function DialogHeader({ options }: Props): VNode {
1414

1515
return (
1616
<h2 class="dialog__header">
17-
{options.formTitle}
17+
<span class="dialog__title">{options.formTitle}</span>
1818
{options.showBranding ? (
1919
<a
2020
class="brand-link"

0 commit comments

Comments
 (0)