Skip to content

fix: mount the viewer into #nc-viewer, not #viewer - #201

Merged
skjnldsv merged 2 commits into
mainfrom
fix/viewer-container-id
Dec 1, 2026
Merged

skjnldsv merged 2 commits into
mainfrom
fix/viewer-container-id

Conversation

@skjnldsv

@skjnldsv skjnldsv commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

On Nextcloud 35 the viewer app still runs next to the library, and its global styles hide the header and reshape the Files sidebar while any #viewer exists (body:has(#viewer)). In the app that's the modal, gone once it closes. The library's container stays, so after the first file opened through it the page had no header until a reload.

Nothing depended on the id: copies of the library find each other through their shared scope, and the modal is teleported to body, so no app style reached it through #viewer anyway.

Fixes #195

👾 This pull request was assisted by Claude Code, commits carry an Assisted-by trailer.

On Nextcloud 35 the viewer app is still on the page, and its styles hide
the header and reshape the Files sidebar while a #viewer exists. Its own
is the modal, gone once closed, while the library's container stays,
so the page was left without a header after the first file opened.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
@skjnldsv skjnldsv added this to the 2.0.0 milestone Dec 1, 2026
@skjnldsv skjnldsv added type: bug 🐛 Something isn't working AI assisted 3. to review labels Dec 1, 2026
@skjnldsv skjnldsv self-assigned this Dec 1, 2026
@codecov

codecov Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.61%. Comparing base (d38f18f) to head (d9bddb6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #201      +/-   ##
==========================================
- Coverage   89.61%   89.61%   -0.01%     
==========================================
  Files          61       61              
  Lines        5305     5304       -1     
  Branches     1150     1150              
==========================================
- Hits         4754     4753       -1     
  Misses        519      519              
  Partials       32       32              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread lib/mount.ts Outdated
// hides the header). Its own is the modal, gone once closed; this one stays
const ViewerRoot = document.createElement('div')
ViewerRoot.id = 'viewer'
ViewerRoot.id = 'nc-viewer'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need a known name here? We could also just use a random generated ID to prevent clashes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better idea, yes 👍

Nothing finds the root again: it is mounted by reference. Without an id
nothing can clash with it, and the tests count mounted apps instead.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
@skjnldsv
skjnldsv merged commit 473fc22 into main Dec 1, 2026
20 checks passed
@skjnldsv
skjnldsv deleted the fix/viewer-container-id branch December 1, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review AI assisted type: bug 🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On Nextcloud 35, the viewer app's body:has(#viewer) rules stick after the library viewer opened once (header hidden until reload)

2 participants