Skip to content

fix: collapse view buttons into dropdown when overflowing#2306

Open
maggch97 wants to merge 7 commits intogo-vikunja:mainfrom
maggch97:user/weijiezhao/viewdropdown
Open

fix: collapse view buttons into dropdown when overflowing#2306
maggch97 wants to merge 7 commits intogo-vikunja:mainfrom
maggch97:user/weijiezhao/viewdropdown

Conversation

@maggch97
Copy link
Contributor

Problem

When a project has many views, the view switcher buttons overflow the screen horizontally, making some views inaccessible.

Solution

Automatically detect when the view buttons would overflow the container and collapse them into a dropdown menu.

  • When buttons fit within the container → show inline buttons as before (no change in UX)
  • When buttons overflow → show a dropdown displaying the current view name with a chevron, clicking it reveals all views in a dropdown menu

Recording 2026-02-26 at 15 47 39

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@maggch97 maggch97 force-pushed the user/weijiezhao/viewdropdown branch from 8e7ba16 to 1818b68 Compare February 26, 2026 08:00
@maggch97 maggch97 force-pushed the user/weijiezhao/viewdropdown branch 3 times, most recently from 20327e3 to 1818b68 Compare February 27, 2026 00:26
maggch97 and others added 3 commits February 27, 2026 08:27
Remove the separate hidden measurement element. Instead, keep the
inline buttons always in the DOM and hide them with CSS when
overflowing, so they serve both as visible buttons and as the
width measurement reference.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Wrap DropdownItems in a div with @click="close" because
BaseButton with :to renders a RouterLink which does not emit
the component-level click event, so @click on DropdownItem
itself has no effect. A native click handler on a wrapper div
catches the bubbled event from the anchor element.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hide the switch-view container until the first overflow check
completes on mount, so users never see inline buttons briefly
flash before collapsing into the dropdown.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@maggch97 maggch97 requested a review from kolaente February 27, 2026 00:46
maggch97 and others added 3 commits February 27, 2026 08:51
Move visibility hiding from the entire container to only the
inline buttons element, so the filter button in the header slot
remains visible during the initial overflow measurement.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Constrain the hidden overflow-measurement element within its
container so it no longer extends beyond the viewport on mobile.
Add position: relative to the container and clip the hidden
element with inset-inline-start/end: 0 and overflow: hidden.
scrollWidth still reports the actual content width for the
overflow check.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

Preview Deployment

Preview deployments for this PR are available at:

URL Tag Commit
https://pr-2306.preview.vikunja.dev ghcr.io/go-vikunja/vikunja:pr-2306 latest
https://sha-d03bf3868eae81e201eebf01dff62f2982a5f830.preview.vikunja.dev ghcr.io/go-vikunja/vikunja:sha-d03bf3868eae81e201eebf01dff62f2982a5f830 d03bf38

The preview environment will start automatically on first visit. Subsequent pushes to this PR will update the pr-2306 image — the preview picks up the new version on restart. The per-commit URLs point to a specific version and will not change.

Run locally with Docker
docker pull ghcr.io/go-vikunja/vikunja:pr-2306
docker run -p 3456:3456 ghcr.io/go-vikunja/vikunja:pr-2306

Last updated for commit d03bf38

@kolaente
Copy link
Member

kolaente commented Mar 4, 2026

Should it do this?

Screen Shot 2026-03-04 at 23 51 41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants