| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| openpublisher5_amd64-windows-portable.exe | 2026-09-27 | 183.2 MB | |
| openpublisher5_amd64-windows.exe | 2026-09-27 | 165.2 MB | |
| openpublisher5_amd64-macos.dmg | 2026-09-27 | 233.1 MB | |
| openpublisher5_amd64-linux.run | 2026-09-27 | 193.4 MB | |
| openpublisher5_amd64-linux.rpm | 2026-09-27 | 215.4 MB | |
| openpublisher5_amd64-linux.flatpak | 2026-09-27 | 153.6 MB | |
| 5.1.7_ Document Load Page Focusing, Viewport Auto-Centering, Focus Outline Removal _ Smooth Horizontal Scrolling source code.tar.gz | 2026-09-27 | 21.5 MB | |
| 5.1.7_ Document Load Page Focusing, Viewport Auto-Centering, Focus Outline Removal _ Smooth Horizontal Scrolling source code.zip | 2026-09-27 | 21.7 MB | |
| README.md | 2026-09-27 | 14.8 kB | |
| openpublisher5_amd64-linux.deb | 2026-09-27 | 156.2 MB | |
| openpublisher5_amd64-linux.AppImage | 2026-09-27 | 176.6 MB | |
| openpublisher5_amd64-freebsd.pkg | 2026-09-27 | 185.5 MB | |
| Totals: 12 Items | 1.7 GB | 0 | |
π Summary
Version 5.1.7 resolves an issue where loading an .opub document, template, or recent publication caused the page canvas to spawn off-screen or at distant viewport scroll offsets, forcing users to manually drag scrollbars to locate their document. This problem was especially noticeable when switching between publications with differing dimensions or resolutions (such as moving from a 96 DPI screen format to a 300 DPI high-resolution print sheet).
Additionally, this release eliminates the black border outline that previously appeared around documents and resolves the horizontal scrolling limitation where side-to-side scrolling was unavailable unless using the pan tool.
With version 5.1.7, Open Publisher introduces a centralized window.focusPage() engine and a dedicated window.updateCanvasScrollBounds() layout coordinator:
- Multi-page spread or overview modes are cleanly exited.
- Selection outlines and floating toolbars are dismissed.
- Viewport scroll positions (
scrollTopandscrollLeft) are reset to 0. - An enhanced, robust
fitToPage()automatically calculates the optical zoom level so the full document is visible within the viewport. - The black focus outline around documents is completely eliminated by removing tabindex manipulation and enforcing
outline: none !important;in CSS. - Native horizontal scrolling (scrollbars, mouse wheel, Shift + Wheel, trackpads) works smoothly across all zoom levels without cutting off the left or right edges of the publication.
[!IMPORTANT] Note for Existing Publications: When working on existing publications, be sure to set the page size and DPI for the publication you are working on and then re-save it. The saved version will successfully remember the set DPI and page size.
π Root Cause Analysis
Investigation identified the technical factors behind each reported issue:
- Persistent Viewport Scroll Offsets on Document Load:
- The main
#viewportcontainer usesoverflow: autowith flex alignment. - When a user scrolled through a large publication or zoomed in during a session, the viewport retained its prior
scrollTopandscrollLeftvalues in memory. -
When a new document was loaded (especially a high-DPI document such as A4 at 300 DPI measuring 2480px x 3508px), the canvas rendered into the scrolled viewport, resulting in negative relative bounding coordinates (for example,
paperRect.top = -524px). The canvas appeared completely off-screen above or to the left of the visible workspace. -
Black Line Around Pages:
- In earlier iterations,
window.focusPage()assignedpaperEl.setAttribute('tabindex', '-1')and invokedpaperEl.focus(). - Chromium and Firefox automatically render a default 1px dark focus rectangle (
outline: auto 1px) around elements with atabindexwhen focused. -
In
style.css,#paperdid not have an explicitoutline: none !important;rule, allowing the browser's default focus ring to show around the entire page. -
Loss of Native Horizontal Scrolling (Side-to-Side):
- The
.viewportflex container usesjustify-content: centerto center the unscaled#paperelement. #papertransforms usingtransform: scale(z)withtransform-origin: top center;.- When zoomed in (e.g., 1.5x, 2.0x, 3.0x or high-DPI documents), the scaled paper expands symmetrically left and right from the center.
- Because
justify-content: centercenters the unscaled layout footprint (794px), the scaled expansion to the left extends into negative coordinates (paperRect.left < viewportRect.left). - Standard CSS scroll containers (
overflow: auto) cannot scroll into negative coordinate space in left-to-right (LTR) mode (scrollLeftminimum is 0). As a result, the left side of the scaled page was cut off and completely inaccessible via scrollbars or mouse wheels. - Furthermore, CSS transforms do not expand layout
scrollWidth, so the viewport'sscrollWidthremained identical toclientWidth, preventing native horizontal scrollbars from appearing. - The pan hand tool was the only mechanism able to reach off-screen content because it directly manipulated
paper.style.leftandpaper.style.topinextensions/system-patches.js. - False positive tests: Earlier automated tests reported
maxScrollvalues of ~629px, but these measuredscrollWidthin the same JavaScript evaluation frame as layout changes, before Chromium's layout engine recalculated. The real browser constraint was that at fit-to-page zoom (~0.44x),scrollWidth = clientWidth + 1(1px of scroll), which persisted after any document load or zoom reset.
π οΈ Enhancements & Architectural Changes
1. Centralized Page Focus Engine (canvas/canvas.js)
- Implemented
window.focusPage(pageIndex = null): - Exits multi-page mode if active and sets
state.viewMode = 'single'. - Automatically switches to the specified
pageIndexif provided. - Clears stale selection overlays, handles, and floating formatting toolbars.
- Resets pan offsets:
paperEl.style.left = ''; paperEl.style.top = '';. - Removes any
tabindexattribute from#paper. - Resets
#viewport.scrollTop = 0. - Invokes
window.fitToPage(). - Calls
window.updateCanvasScrollBounds()to ensure the paper bounds and scroll ranges are fully synchronized. - Synchronizes rulers, margin guide overlays, handle scaling, and minimap displays.
2. Elimination of Black Focus Outline (style.css, canvas/canvas.js)
- In
style.css: - Added
outline: none !important;directly to the#paperruleset. - Added
#paper:focus, #paper:focus-visible { outline: none !important; }. - In
canvas/canvas.js: - Removed
tabindexand.focus()calls entirely fromwindow.focusPage(). - Explicitly strips
tabindexif present on#paper.
3. Dynamic Canvas Scroll Bounds Engine (canvas/canvas.js)
- Implemented
window.updateCanvasScrollBounds(): - Bypasses adjustments while the pan hand tool is actively engaged (
viewport.classList.contains('panning')). - Calculates
naturalLeft = (vpW - scaledW) / 2- where the paper's left edge would naturally fall with flex centering. - Computes
shiftNeeded = pad - naturalLeftto determine how much to shift the paper right so its left edge stays at least 50px from the viewport left edge atscrollLeft = 0. - If
shiftNeeded > 0(page overflows viewport): setspaper.style.left = shiftNeeded + 'px'and injects a#canvas-scroll-sizerdiv atleft = pad + scaledW + padto forcescrollWidthto cover the full scaled width with equal 50px padding on each side. - If
shiftNeeded <= 0(page fits in viewport): clearspaper.style.leftand removes the sizer entirely, preventing any spurious horizontal scrollbar. - Hooked into
window.setZoom(),window.focusPage(), and windowresizeevents. - Restores full native side-to-side scrolling via scrollbar track dragging, horizontal mouse wheel (
deltaX), and Shift + vertical wheel (deltaY).
4. Resilient fitToPage() and fitToWidth() Fallbacks (canvas/canvas.js)
- Replaced fragile DOM dimension checks with multi-tier fallbacks:
paperW = paperEl.offsetWidth || parseInt(paperEl.style.width) || (state.pages[state.currentPageIndex] && parseInt(state.pages[state.currentPageIndex].width)) || 794paperH = paperEl.offsetHeight || parseInt(paperEl.style.height) || (state.pages[state.currentPageIndex] && parseInt(state.pages[state.currentPageIndex].height)) || 1123- Guaranteed that optical zoom calculations succeed consistently across all page sizes and resolutions.
5. File Loader Focus Integration (io/publisher-file-loader.js)
- In
loadDocumentData(): - Invokes
window.focusPage(0)immediately followingrenderPage(state.pages[0]). - Executes a second
window.focusPage(0)pass in the 100ms post-render timeout alongsidesyncMarginGuideOverlay(). - Ensures
.opub,.json,.pub, and.docxpublications always open centered and fully visible.
6. Dashboard Start Screen & Recent Files (ui/dashboard.js)
- In
startBlank(size): - Invokes
window.focusPage(0)after generating the initial blank canvas. - In recent file card clicks (
card.onclick): - Invokes
window.focusPage(state.currentPageIndex)immediately upon card activation and again at 100ms. - Updated template index request parameter to
template-index.json?v=5.1.7.
7. Template Library Integration (elements/templates/templates.js)
- In
loadTemplate(opubData): - Calls
window.focusPage(0)directly upon rendering the template's first page. - Re-triggers
window.focusPage(0)in the 50ms post-render timeout to adjust for template fonts and asset layout settling.
8. Global Cachebuster Bump (index.html)
- Bumped all script, stylesheet, and asset cachebuster query strings from
?v=5.1.6to?v=5.1.7acrossindex.html.
π§ͺ Verification & Automated Testing
Two comprehensive test suites were created and executed in Playwright against the production codebase:
Suite A: Focus & Document Loading Suite (scratch/test_focus_v517_verification.py)
All 10 verification scenarios passed with zero errors:
- A4 @ 300 DPI Publication Load:
scrollTop = 0,scrollLeft = 0,zoom = 0.141,isEntirelyVisible = True. - Letter @ 96 DPI Publication Load:
scrollTop = 0,scrollLeft = 0,zoom = 0.468,isEntirelyVisible = True. - Tabloid @ 150 DPI Publication Load:
scrollTop = 0,scrollLeft = 0,zoom = 0.194,isEntirelyVisible = True. - Business Card @ 300 DPI Publication Load:
scrollTop = 0,scrollLeft = 0,zoom = 0.823,isEntirelyVisible = True. - Template Library Load:
scrollTop = 0,scrollLeft = 0,zoom = 0.440,isEntirelyVisible = True. - Dashboard Blank Document Launch:
scrollTop = 0,scrollLeft = 0,zoom = 0.440,isEntirelyVisible = True. - Interactive Page Format Change (
setPageSize):scrollTop = 0,scrollLeft = 0,zoom = 0.303,isEntirelyVisible = True. - Manual High Zoom & Focus Recovery: Zoom set to 2.5x with viewport scrolled to (1200, 800), followed by
window.focusPage(). Result:scrollTop = 0,scrollLeft = 0,isEntirelyVisible = True. - New Document Dialog (
handleNewDocument):scrollTop = 0,scrollLeft = 0,zoom = 0.440,isEntirelyVisible = True. - Dashboard Recent Publication Card Click: Restored recent Tabloid document from
op_recent_files. Result:scrollTop = 0,scrollLeft = 0,zoom = 0.194,isEntirelyVisible = True.
Suite B: Outline Elimination & Side-to-Side Scrolling Suite (scratch/test_verify_real_files.py)
All 18 verification checks passed with zero errors:
- Fit-to-page zoom: zero horizontal scroll - No spurious scrollbar at default zoom.
- scrollLeft reset on load -
scrollLeft == 0after document open. - No pan offset on paper -
paper.style.leftis empty after load. - No black outline -
outline: noneconfirmed via computed style. - scrollWidth correct at zoom 2.0 -
scrollWidth = 1688(pad + scaledW + pad). - maxScroll > 100px at zoom 2.0 -
maxScroll = 628px. - scrollLeft stays at 200 after 200ms - Scroll is not reset asynchronously.
- Shift+Wheel produces scroll -
scrollLeft = 120after horizontal wheel event. - Right padding at max scroll = 50px - Symmetric 50px padding on each side.
- Left padding at scroll-left=0 = 50px - 50px breathing room on left edge.
- fitToPage resets scrollLeft to 0 - Calling fitToPage() after panning resets scroll.
- fitToPage maxScroll <= 5px - No horizontal overflow after fit-to-page. 13-17. All zoom levels (1.0x - 3.0x) have correct maxScroll - Zero at zoom 1.0, 231 at 1.5x, 628 at 2.0x, 1025 at 2.5x, 1422 at 3.0x.
- Pan tool bypass -
panningCSS class preventsupdateCanvasScrollBoundsfrom overriding pan offsets.
β Checklist Completed
- [x]
style.css: Addedoutline: none !important;to#paperand#paper:focus, #paper:focus-visibleto permanently eliminate the dark focus border. - [x]
canvas/canvas.js: Createdwindow.updateCanvasScrollBounds()with corrected sizer formula (rightEdge = pad + scaledW + pad), restoring native side-to-side scrolling without left-side clipping across all zoom levels (1.0x through 3.0x verified). - [x]
canvas/canvas.js: Sizer is only created when content overflows the viewport; it is removed when the page fits, preventing spurious horizontal scrollbars. - [x]
canvas/canvas.js: Hookedwindow.updateCanvasScrollBounds()intowindow.setZoom()and windowresizeevents. - [x]
canvas/canvas.js: Updatedwindow.focusPage()to removetabindexand.focus(), reset pan offsets, resetscrollTop = 0, callfitToPage(), and callupdateCanvasScrollBounds(). - [x]
layout/document.js: CoordinatedsetPageSize()andopenPageSizeModalwithwindow.focusPage()andwindow.updateCanvasScrollBounds(). - [x]
io/publisher-file-loader.js: Maintained immediate and delayedwindow.focusPage(0)calls inloadDocumentData()to center every opened.opub,.json,.pub, and.docxfile. - [x]
ui/dashboard.js: Maintainedwindow.focusPage(0)instartBlank()and recent file card handlers; bumped template index query parameter to?v=5.1.7. - [x]
elements/templates/templates.js: Maintained immediate and delayedwindow.focusPage(0)calls inloadTemplate(). - [x]
core/pages.js: ScopedcurrentPresettohandleNewDocument()outer function; maintainedwindow.focusPage(0)upon document creation. - [x]
index.html: Bumped all script, stylesheet, and asset cachebusters from?v=5.1.6to?v=5.1.7. - [x] Automated Verification: Executed automated test suites (
test_focus_v517_verification.pyandtest_verify_real_files.py), passing all 28 test cases (18 + 10).
π Version 5.1.7 - Open Publisher