citation dlg: fix row cutoff on linux after resize

When resizing the window in list mode to match the height
of the content, account for the difference between
outerHeight and innerHeight of the window on Linux.
outerHeight > innerHeight (perhaps Linux includes chrome,
borders, etc. in its outerHeight), so we have to add their difference
to the desired height for resizing. Otherwise, the visible
dialog ends up receiving only some of the desired height and
the last row is cut off.

Also, ensure that in tests, we wait for searching triggered by
switching dialog mode to finish before running the next search.

Fixes: zotero#5502
This commit is contained in:
Bogdan Abaev 2025-08-20 10:23:44 -07:00 • committed by Adomas Ven
parent 2f262c943c
commit 098be27375
2 changed files with 15 additions and 0 deletions

View file

@ -878,6 +878,13 @@ class ListLayout extends Layout {
// set min height and resize the window
let autoHeight = bubbleInputHeight + sectionsHeight + sectionsWrapperPadding + bottomHeight + marginOfError;
// window.resizeTo(X,Y) resizes the window so that it's outerHeight == Y. On mac and windows,
// innerHeight and outerHeight are the same. On linux, the outerHeight > innerHeight, perhaps
// outerHeight there includes chrome, borders, etc. This difference is accounted for below, so that the dialog
// itself (not the outer window) ends up with the desired height.
if (Zotero.isLinux) {
autoHeight += (window.outerHeight - window.innerHeight);
}
let minHeight = bubbleInputHeight + bottomHeight;
doc.documentElement.style.minHeight = `${minHeight}px`;

View file

@ -415,6 +415,10 @@ describe("Citation Dialog", function () {
it("should perform search in list mode", async function () {
IOManager.toggleDialogMode("list");
// Wait for search triggered after switching dialog modes to finish
while (SearchHandler.searching) {
await Zotero.Promise.delay(10);
}
// Search for "one"
await dialog.currentLayout.search("one", { skipDebounce: true });
// Selected items should have both "one_selected" and "one_selected_open"
@ -442,6 +446,10 @@ describe("Citation Dialog", function () {
it("should perform search in library mode", async function () {
IOManager.toggleDialogMode("library");
// Wait for search triggered after switching dialog modes to finish
while (SearchHandler.searching) {
await Zotero.Promise.delay(10);
}
// Search for "one"
await dialog.currentLayout.search("one", { skipDebounce: true });
// Selected items should have both "one_selected" and "one_selected_open"