fix(web): inline HTML renders no longer trap the thread's scroll #16283
Mergedt3dotgg(GitHub profile, opens in a new tab)merged 3 commits into
main fromrefs/pull/16283/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
juliusmarminge added labelsmacroscope-review
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- packages/shared/src/htmlRender.ts lines 128 to 128Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -116,0 +108,21 @@108+}109+110+/**111+ * The frame height for a page at a frame width. It is the page's own reported112+ * `contentHeight` when the client has one, else the server's measurement for113+ * that width. A page even a few pixels taller than its frame scrolls inside it114+ * and takes the reader's scroll, so the frame fits the page. The agent's height115+ * caps it only when it is below the page's height at the column width (the116+ * agent asked for a scrolling frame) or when the page was never measured.117+ */118+export function htmlRenderFrameHeight(119+ reference: HtmlRenderReference,120+ width: number,121+ contentHeight?: number,122+) {123+ const heights = reference.heights;124+ if (heights === undefined || heights.length === 0) {125+ return clampHtmlRenderHeight(Math.min(reference.height, contentHeight ?? reference.height));126+ }127+ const cap =128+ measuredHeight(heights, HTML_RENDER_COLUMN_WIDTH) > reference.heightapps/web/src/components/files/BrowserDocumentFrame.tsx line 109OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -102,3 +105,5 @@102105 window.addEventListener("message", openLink);103106 return () => window.removeEventListener("message", openLink);104107 }, []);108+ const { onContentHeight } = props;109+ useEffect(() => {
github-actions[bot](GitHub profile, opens in a new tab) removed labelssize:M
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
- @@ -116,0 +110,21 @@110+/**111+ * The frame height for a page at a frame width. It is the page's own reported112+ * `contentHeight` when the client has one, else the server's measurement for113+ * that width. A page even a few pixels taller than its frame scrolls inside it114+ * and takes the reader's scroll, so the frame fits the page. The agent's height115+ * caps it only when it is below the page's height at the column width (the116+ * agent asked for a scrolling frame) or when the page was never measured.117+ */118+export function htmlRenderFrameHeight(119+ reference: HtmlRenderReference,120+ width: number,121+ contentHeight?: number,122+) {123+ const heights = reference.heights;124+ if (heights === undefined || heights.length === 0) {125+ return clampHtmlRenderHeight(Math.min(reference.height, contentHeight ?? reference.height));126+ }127+ const cap =128+ measuredHeight(heights, HTML_RENDER_COLUMN_WIDTH) > reference.height129+ ? reference.height130+ : HTML_RENDER_MAX_HEIGHT;
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed