diff --git a/frontend/src/ts/modals/quote-search.ts b/frontend/src/ts/modals/quote-search.ts index 7dc67ba651b8..f9442110d618 100644 --- a/frontend/src/ts/modals/quote-search.ts +++ b/frontend/src/ts/modals/quote-search.ts @@ -56,7 +56,7 @@ function applyQuoteLengthFilter(quotes: Quote[]): Quote[] { if (!modal.isOpen()) return []; const quoteLengthDropdown = modal .getModal() - .qs(".quoteLengthFilter"); + .qs("select.quoteLengthFilter"); const selectedOptions = quoteLengthDropdown ? Array.from(quoteLengthDropdown.native.selectedOptions) : []; diff --git a/frontend/src/ts/test/test-screenshot.ts b/frontend/src/ts/test/test-screenshot.ts index 87cf8085258f..7f2c42630a11 100644 --- a/frontend/src/ts/test/test-screenshot.ts +++ b/frontend/src/ts/test/test-screenshot.ts @@ -29,7 +29,7 @@ function revert(): void { qs(".pageTest .buttons")?.show(); qs("noscript")?.show(); qs("#nocss")?.show(); - qsa("header, footer")?.show(); + qsa("header, footer")?.removeClass("invisible"); qs("#result")?.removeClass("noBalloons"); qs(".wordInputHighlight")?.show(); qs(".highlightContainer")?.show(); @@ -119,8 +119,11 @@ async function generateCanvas(): Promise { } await Misc.sleep(50); // Small delay for render updates - const sourceX = src.getOffsetLeft() ?? 0; - const sourceY = src.getOffsetTop() ?? 0; + const sourceX = src.screenBounds().left ?? 0; + const sourceY = src.screenBounds().top ?? 0; + + console.log(sourceX, sourceY); + const sourceWidth = src.getOuterWidth(); const sourceHeight = src.getOuterHeight(); const paddingX = convertRemToPixels(2); diff --git a/frontend/src/ts/utils/dom.ts b/frontend/src/ts/utils/dom.ts index 8ab325ce785f..29f9c59d0b9e 100644 --- a/frontend/src/ts/utils/dom.ts +++ b/frontend/src/ts/utils/dom.ts @@ -580,14 +580,19 @@ export class ElementWithUtils { } /** - * Get the element's bounding client rect offset + * Get the element's screen bounds: top, left, width and height */ - offset(): { top: number; left: number } { + screenBounds(): { top: number; left: number; width: number; height: number } { const rect = this.native.getBoundingClientRect(); const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft; const scrollTop = window.pageYOffset || document.documentElement.scrollTop; - return { top: rect.top + scrollTop, left: rect.left + scrollLeft }; + return { + top: rect.top + scrollTop, + left: rect.left + scrollLeft, + width: rect.width, + height: rect.height, + }; } /**