Skip to content

Commit d19c1e9

Browse files
committed
chore: reduce vertical bump on modal dialogs
Our 'centered' dialogs aren't really centered - we bump them up vertically a little bit because this helps draw attention and looks nice visually. However, when the window is near it's smallest and the dialog is at its biggest, we can run into problems where the top of the dialog goes 'underneath' the titlebar. This reduces the vertical bump from 20% to 5%. This still gives the subtle effect, but dialogs will never have this problem at our default window size. We could get more clever and check the window size, reduce the maximum height of the dialog, or try to fix fully by changing z-index and possibly adding window scrollbars if things still don't fit, but this is way simpler and should solve >99% of the time. Fixes podman-desktop#8091. Signed-off-by: Tim deBoer <[email protected]>
1 parent 54d8ba9 commit d19c1e9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/ui/src/lib/modal/Modal.spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ describe('translation-y', () => {
5656
render(Modal);
5757

5858
const dialog = screen.getByRole('dialog');
59-
expect(dialog.classList).toContain('translate-y-[-20%]');
59+
expect(dialog.classList).toContain('translate-y-[-5%]');
6060
expect(dialog.classList).not.toContain('my-[32px]');
6161
});
6262

6363
test('modal with top should not have translate-y', async () => {
6464
render(Modal, { top: true });
6565

6666
const dialog = screen.getByRole('dialog');
67-
expect(dialog.classList).not.toContain('translate-y-[-20%]');
67+
expect(dialog.classList).not.toContain('translate-y-[-5%]');
6868
// should contain margin of size status bar height
6969
expect(dialog.classList).toContain('my-[32px]');
7070
});

packages/ui/src/lib/modal/Modal.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ if (previously_focused) {
4141
on:click={onclose}></button>
4242

4343
<div
44-
class:translate-y-[-20%]={!top}
44+
class:translate-y-[-5%]={!top}
4545
class:my-[32px]={top}
4646
class="bg-[var(--pd-modal-bg)] z-50 rounded-xl overflow-auto w-[calc(200vw-4em)] h-fit max-w-[42em] max-h-[calc(100vh-4em)] border-[1px] border-[var(--pd-modal-border)]"
4747
role="dialog"

0 commit comments

Comments
 (0)