Skip to content

Commit df7d25c

Browse files
luis100claude
andcommitted
fix: set PDFViewer container position:absolute via inline style
PDFViewer checks getComputedStyle(container).position === 'absolute' at construction time. The CSS class alone is not reliable (possible GWT class pruning or loading-order race). Set all critical layout properties inline on scrollContainer, scrollWrapper, and content so the check always passes regardless of CSS class availability. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 76c7cf1 commit df7d25c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

roda-ui/roda-wui/src/main/resources/static/js/rodaPdfViewer.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@
130130
function buildDOM(state) {
131131
var viewer = state.viewerEl;
132132

133+
/* The viewer element must be a flex column so content fills it */
134+
viewer.style.cssText += ';display:flex;flex-direction:column;';
135+
133136
/* Loading indicator */
134137
var loading = mk('div', 'rodaPdfLoading');
135138
loading.textContent = 'Loading document\u2026';
@@ -240,6 +243,7 @@
240243

241244
/* ---- Content area: sidebar + scroll container ---- */
242245
var content = mk('div', 'rodaPdfContent');
246+
content.style.cssText = 'position:relative;flex:1;display:flex;overflow:hidden;';
243247
var sidebar = mk('div', 'rodaPdfSidebar');
244248
var sidebarContent = mk('div', 'rodaPdfSidebarContent');
245249
sidebar.appendChild(sidebarContent);
@@ -252,6 +256,15 @@
252256
var scrollWrapper = mk('div', 'rodaPdfScrollWrapper');
253257
var scrollContainer = mk('div', 'rodaPdfScrollContainer');
254258
var pdfViewerDiv = mk('div', 'pdfViewer');
259+
260+
/*
261+
* PDFViewer requires the container to have position:absolute (it checks
262+
* via getComputedStyle). Set this as an inline style so it is guaranteed
263+
* to be present regardless of CSS class loading order or GWT compilation.
264+
*/
265+
scrollWrapper.style.cssText = 'position:relative;flex:1;min-width:0;overflow:hidden;';
266+
scrollContainer.style.cssText = 'position:absolute;overflow:auto;top:0;right:0;bottom:0;left:0;outline:none;';
267+
255268
scrollContainer.appendChild(pdfViewerDiv);
256269
scrollWrapper.appendChild(scrollContainer);
257270

0 commit comments

Comments
 (0)