Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2328,12 +2328,15 @@ body:not(.is-mobile)
flex-direction: column;
align-items: center;
justify-content: center;
/* The container is the modal's content element; let it shrink to the modal's
bounded height so the release notes scroll instead of growing it. */
min-height: 0;
}

.quickadd-update-modal {
min-width: 35%;
max-width: 90%;
max-height: 70%;
flex: 1 1 auto;
/* Let the scroll region shrink below its content height so the non-shrinking
footer always fits inside the centered column — otherwise tall notes on a
short viewport could overflow and clip the Done button out of view (#635). */
Expand Down
37 changes: 37 additions & 0 deletions tests/e2e/update-modal-layout.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { expect, it } from "vitest";
import { createQuickAddE2EHarness } from "./e2eVault";

const getContext = createQuickAddE2EHarness("update-modal-layout");

// Upgrading from an old version fills the What's new modal with up to 100
// releases. The notes must scroll inside the modal so the Done footer stays in
// view (#635). The DOM mirrors UpdateModal: its contentEl carries the container
// class, followed by the notes and the footer.
it("keeps the Done footer in view when the release notes are long", async () => {
const { obsidian } = getContext();
const layout = await obsidian.dev.evalJson<{
modalBottom: number;
footerBottom: number;
notesScrolls: boolean;
}>(`(() => {
const container = document.body.createDiv({ cls: "modal-container mod-dim" });
try {
container.createDiv({ cls: "modal-bg" });
const modal = container.createDiv({ cls: "modal" });
const content = modal.createDiv({ cls: "modal-content quickadd-update-modal-container" });
const notes = content.createDiv({ cls: "quickadd-update-modal" });
for (let i = 0; i < 300; i++) notes.createEl("p", { text: "Release note " + i });
const footer = content.createDiv({ cls: "quickadd-update-modal-footer" });
footer.createEl("button", { text: "Done" });
return {
modalBottom: modal.getBoundingClientRect().bottom,
footerBottom: footer.getBoundingClientRect().bottom,
notesScrolls: notes.scrollHeight > notes.clientHeight,
};
} finally {
container.remove();
}
})()`);
expect(layout.notesScrolls).toBe(true);
expect(layout.footerBottom).toBeLessThanOrEqual(layout.modalBottom);
});
Loading