Skip to content

Commit 6048595

Browse files
justjanneJanBurp
authored andcommitted
Prevent Invite and DevTools dialogs from being cut off (matrix-org#8646)
* fix: replace fixed height based styling with flex for invite and dev dialogs * feat: create flex wrapper class for dialogs * feat: make invite dialogs use flex layout * feat: make devtools dialogs use flex layout
1 parent e46dd0d commit 6048595

File tree

4 files changed

+53
-33
lines changed

4 files changed

+53
-33
lines changed

res/css/views/dialogs/_DevtoolsDialog.scss

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,24 @@ limitations under the License.
1616

1717
.mx_DevtoolsDialog_wrapper {
1818
.mx_Dialog {
19-
height: 100%;
19+
display: flex;
20+
flex-direction: column;
2021
}
2122

2223
.mx_Dialog_fixedWidth {
23-
overflow-y: hidden;
24-
height: 100%;
24+
display: flex;
25+
flex-direction: column;
26+
min-height: 0;
27+
max-height: 100%;
28+
29+
.mx_Dialog_buttons button {
30+
margin-bottom: 0;
31+
}
2532
}
2633
}
2734

2835
.mx_DevTools_content {
2936
overflow-y: auto;
30-
height: calc(100% - 124px); // 58px for buttons + 50px for header + 8px margin around
3137
}
3238

3339
.mx_DevTools_RoomStateExplorer_query {

res/css/views/dialogs/_InviteDialog.scss

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
.mx_InviteDialog_flexWrapper .mx_Dialog {
18+
display: flex;
19+
flex-direction: column;
20+
}
21+
1722
.mx_InviteDialog_transferWrapper .mx_Dialog {
1823
padding-bottom: 16px;
1924
}
@@ -128,8 +133,9 @@ limitations under the License.
128133
text-transform: uppercase;
129134
}
130135

131-
.mx_CopyableText {
136+
.mx_CopyableText.mx_CopyableText_border {
132137
width: unset; // full width
138+
margin-bottom: 0;
133139

134140
> a {
135141
text-decoration: none;
@@ -270,44 +276,54 @@ limitations under the License.
270276

271277
.mx_InviteDialog_other {
272278
// Prevent the dialog from jumping around randomly when elements change.
273-
height: 600px;
279+
display: flex;
280+
flex-direction: column;
281+
max-height: 600px;
282+
overflow: hidden;
274283

275284
.mx_InviteDialog_addressBar {
276285
margin-right: 0;
277286
}
278287

279288
.mx_InviteDialog_userSections {
280-
height: calc(100% - 115px); // mx_InviteDialog's height minus some for the upper and lower elements
281289
padding-right: 0;
282290

283291
.mx_InviteDialog_section {
284292
padding-bottom: 0;
285293
margin-top: 12px;
286294
}
287295
}
288-
289-
.mx_InviteDialog_hasFooter {
290-
.mx_InviteDialog_userSections {
291-
height: calc(100% - 175px); // For displaying an invite link on the footer of the dialog
292-
}
293-
}
294296
}
295297

296298
.mx_InviteDialog_content {
297-
height: calc(100% - 36px); // full height minus the size of the header
299+
display: flex;
300+
flex-direction: column;
301+
flex-shrink: 1;
298302
overflow: hidden;
299303
}
300304

301305
.mx_InviteDialog_transfer {
302-
width: 496px;
303-
height: 466px;
304-
flex-direction: column;
306+
width: auto;
305307

306308
.mx_InviteDialog_content {
307-
flex-direction: column;
309+
width: 496px;
310+
height: 430px;
308311

309312
.mx_TabbedView {
310-
height: calc(100% - 60px);
313+
display: flex;
314+
flex-direction: column;
315+
flex-shrink: 1;
316+
flex-grow: 1;
317+
min-height: 0;
318+
319+
.mx_TabbedView_tabPanel {
320+
flex-direction: column;
321+
322+
.mx_TabbedView_tabPanelContent {
323+
display: flex;
324+
flex-direction: column;
325+
}
326+
}
311327
}
312328
overflow: visible;
313329
}
@@ -327,10 +343,6 @@ limitations under the License.
327343
padding: 0 45px 4px 0;
328344
}
329345

330-
.mx_InviteDialog_hasFooter .mx_InviteDialog_userSections {
331-
height: calc(100% - 175px);
332-
}
333-
334346
.mx_InviteDialog_helpText {
335347
margin: 0;
336348
}
@@ -380,14 +392,13 @@ limitations under the License.
380392

381393
.mx_InviteDialog_transferConsultConnect {
382394
padding-top: 16px;
383-
/* This wants a drop shadow the full width of the dialog, so relative-position it
384-
* and make it wider, then compensate with padding
395+
/* This wants a drop shadow the full width of the dialog, so use negative margin to make it full width,
396+
* then compensate with padding
385397
*/
386-
position: relative;
387-
width: 496px;
388-
left: -24px;
389398
padding-left: 24px;
390399
padding-right: 24px;
400+
margin-left: -24px;
401+
margin-right: -24px;
391402
border-top: 1px solid $quinary-content;
392403

393404
display: flex;

src/RoomInvite.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export function showStartChatInviteDialog(initialText = ""): void {
6363
// This dialog handles the room creation internally - we don't need to worry about it.
6464
Modal.createTrackedDialog(
6565
'Start DM', '', InviteDialog, { kind: KIND_DM, initialText },
66-
/*className=*/null, /*isPriority=*/false, /*isStatic=*/true,
66+
/*className=*/"mx_InviteDialog_flexWrapper", /*isPriority=*/false, /*isStatic=*/true,
6767
);
6868
}
6969

@@ -75,7 +75,7 @@ export function showRoomInviteDialog(roomId: string, initialText = ""): void {
7575
initialText,
7676
roomId,
7777
},
78-
/*className=*/null, /*isPriority=*/false, /*isStatic=*/true,
78+
/*className=*/"mx_InviteDialog_flexWrapper", /*isPriority=*/false, /*isStatic=*/true,
7979
);
8080
}
8181

src/utils/DialogOpener.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17+
import classnames from "classnames";
18+
1719
import defaultDispatcher from "../dispatcher/dispatcher";
1820
import { ActionPayload } from "../dispatcher/payloads";
1921
import Modal from "../Modal";
@@ -89,9 +91,10 @@ export class DialogOpener {
8991
kind: payload.kind,
9092
call: payload.call,
9193
roomId: payload.roomId,
92-
}, payload.className, false, true).finished.then((results) => {
93-
payload.onFinishedCallback?.(results);
94-
});
94+
}, classnames("mx_InviteDialog_flexWrapper", payload.className), false, true).finished
95+
.then((results) => {
96+
payload.onFinishedCallback?.(results);
97+
});
9598
break;
9699
case Action.OpenAddToExistingSpaceDialog: {
97100
const space = payload.space;

0 commit comments

Comments
 (0)