Skip to content

feat(docs): enable popout modal for large tables#693

Merged
OrlinVasilev merged 4 commits intogoharbor:mainfrom
Iam-Karan-Suresh:feature/docs-table-popout
Mar 2, 2026
Merged

feat(docs): enable popout modal for large tables#693
OrlinVasilev merged 4 commits intogoharbor:mainfrom
Iam-Karan-Suresh:feature/docs-table-popout

Conversation

@Iam-Karan-Suresh
Copy link
Contributor

@Iam-Karan-Suresh Iam-Karan-Suresh commented Dec 28, 2025

What does this PR do?

Adds a pop-out option for wide tables so they can be viewed in full size without horizontal scrolling.
This improves readability and usability, especially on smaller screens.

Why is this change needed?

Some documentation tables overflow the content area and require horizontal scrolling,
which makes them hard to read. A pop-out view allows users to focus on the table content
without layout constraints.

Context

I previously commented on the issue and followed up on Slack.
As this is a small UI fix, I proceeded with a PR to move things forward.

How was this tested?

  • Verified locally by opening documentation pages with wide tables
  • Confirmed the pop-out view displays the full table correctly
  • Checked responsiveness across d
    Screencast from 2025-12-28 18-02-01.webm
    ifferent viewport sizes

Related Issue

#601

Happy to update this PR based on feedback.

Signed-off-by: Iam-karan-suresh <karansuresh.info@gmail.com>
Copy link
Contributor

@bupd bupd left a comment

Choose a reason for hiding this comment

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

/lgtm

@dmaes
Copy link

dmaes commented Feb 18, 2026

This improves readability and usability, especially on smaller screens.

This would improve usability on just about any screen size.

Tables are pretty much unusable due to horizontal scrolling, while half of my screen is just whitespace...

image

Copy link
Member

@OrlinVasilev OrlinVasilev left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a pop-out modal feature for wide documentation tables to improve readability — especially on smaller screens — by letting users view tables at full viewport size without horizontal scrolling. It introduces a new JavaScript file, registers it globally, and adds the supporting CSS styles.

Changes:

  • New static/js/table-popout.js: Wraps .content table elements with a scroll container and an "enlarge" button; clicking it opens a full-screen modal with a cloned copy of the table.
  • Updated layouts/partials/javascript.html: Loads the new script globally on every page.
  • Updated assets/sass/helpers.sass: Adds styles for the table wrapper, scroll container, enlarge button, modal, overlay, and close button; also removes trailing whitespace on existing lines.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 9 comments.

File Description
static/js/table-popout.js Core logic: wraps all content tables, handles enlarge button, clones table into modal, manages keyboard/click-to-close
layouts/partials/javascript.html Registers the new script globally on every page
assets/sass/helpers.sass Styles for table wrapper, modal, overlay, enlarge/close buttons; minor whitespace cleanup

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +100 to +104
modal.appendChild(closeBtn);
modal.appendChild(cloned);
// append overlay then modal so overlay is below modal
document.body.appendChild(overlay);
document.body.appendChild(modal);
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

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

The modal created by openTableModal has no ARIA attributes to convey its semantics to screen readers:

  • The modal element is missing role="dialog" and aria-modal="true" to indicate it's a dialog.
  • Neither aria-label nor aria-labelledby is set on the modal, so assistive technologies have no way to announce its purpose.
  • When the modal opens, focus is not moved into the modal, so keyboard users will be stuck in the background page.
  • When the modal closes, focus is not restored to the triggering button (btn).
    These are all required for WCAG 2.1 compliance. Consider using modal.setAttribute("role", "dialog"), modal.setAttribute("aria-modal", "true"), modal.setAttribute("aria-label", "Table enlarged view"), moving focus to closeBtn on open, and restoring focus to btn on close.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

@OrlinVasilev OrlinVasilev enabled auto-merge (squash) March 2, 2026 11:56
Vad1mo added 3 commits March 2, 2026 13:05
Hugo 0.154 removed site.IsServer (replaced by hugo.IsServer) and
now returns nil for .File on pages without a backing file (list pages,
home page). Wrap all .File.Path accesses in {{ with .File }} guards
and switch to hugo.IsServer so the site builds on both old and new
Hugo versions.

Signed-off-by: Vadim Bauer <1492007+Vad1mo@users.noreply.github.com>
- Add aria-label to enlarge/close buttons, role="dialog" and
  aria-modal on the modal element
- Focus close button on open, restore focus to trigger on close
- Lock body scroll while modal is open
- Guard against opening multiple modals simultaneously
- Fix overlay z-index (10 → 9998) so it covers the navbar
- Replace broken sticky+float on close button with sticky+margin-left
- Use visible focus outlines instead of near-invisible box-shadow
- Remove unnecessary computed style copying (clone inherits CSS)
- Extract table popout styles into dedicated sass file

Signed-off-by: Vadim Bauer <1492007+Vad1mo@users.noreply.github.com>
hugo.IsServer requires Hugo 0.120+. The Netlify deploy uses
Hugo 0.74.0, so use .Site.IsServer which works across all versions.

Signed-off-by: Vadim Bauer <1492007+Vad1mo@users.noreply.github.com>
@OrlinVasilev OrlinVasilev merged commit 2a62fd5 into goharbor:main Mar 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants