Skip to content

fix: make current breadcrumb item clickable on mobile - #3476

Merged
AlexAndBear merged 6 commits into
mainfrom
fix/mobile-breadcrumb-clickable
Sep 30, 2026
Merged

AlexAndBear merged 6 commits into
mainfrom
fix/mobile-breadcrumb-clickable

Conversation

@AlexAndBear

@AlexAndBear AlexAndBear commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Description

On mobile screens, OcBreadcrumb hides the breadcrumb list and shows only the current (last) item in .oc-breadcrumb-mobile-current. That element was hard-coded as a plain <span> and ignored the item's to and onClick. So on mobile you couldn't click the current breadcrumb, while on desktop the same item is a router link or a button, e.g. to reload the Spaces, Deleted files or Search results list.

The mobile current item now renders the same way as on desktop:

  • a router link (routerLinkComponent) if the item has to
  • a button that calls the handler if the item has onClick
  • plain text otherwise, as before

Link and button items stay bold. The icon is part of the clickable area, aria-current="page" is kept, and clickable items get a pointer cursor and underline on hover.

The context menu (showContextActions) stays desktop-only, as before.

Refactoring

OcBreadcrumb.vue was well above the ~300 line guideline, and the item rendering was duplicated between the desktop list and the mobile view. It's now split into two internal sub-components:

  • OcBreadcrumbItem.vue renders a single item as a router link, a button or plain text. Both the desktop list and the mobile current item use it.
  • OcBreadcrumbContextMenu.vue contains the "three dots" trigger and its dropdown. The trigger now gets a unique id instead of the fixed #oc-breadcrumb-contextmenu-trigger.

OcBreadcrumb.vue shrinks from ~450 to ~330 lines. Side effects:

  • A current item without to or onClick (plain text) is no longer bold, on desktop and mobile. Previously it was bold on mobile only
  • aria-current="page" is now determined from the displayed items instead of the original items, so it's correct when items are truncated

Related Issue

  • Fixes <issue_link>

How Has This Been Tested?

  • test environment: local dev setup (Vite dev server + OpenCloud backend via docker-compose), Chromium with a 390x844 mobile viewport; Vitest
  • test case 1: Spaces page on mobile, the breadcrumb title renders as a button and clicking it reloads the spaces list
  • test case 2: desktop "Personal > New folder": breadcrumb looks unchanged and the context menu opens with the folder actions
  • test case 3: mobile "New folder": back navigation and a bold, clickable current item, no context menu
  • test case 4: new unit tests for OcBreadcrumbItem (link, button with click handler, plain text, current state, icon) and for the context menu placement
  • test case 5: full unit test suite, type check, lint and format pass

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@AlexAndBear AlexAndBear self-assigned this Sep 28, 2026
@AlexAndBear
AlexAndBear merged commit 5cec546 into main Sep 30, 2026
31 checks passed
@AlexAndBear
AlexAndBear deleted the fix/mobile-breadcrumb-clickable branch September 30, 2026 09:12
openclouders pushed a commit that referenced this pull request Sep 30, 2026
* fix: make current breadcrumb item clickable on mobile

* refactor: split OcBreadcrumb into item and context menu sub-components

* fix: only mark desktop breadcrumb item as last item text

* fix: don't render plain text breadcrumb items bold

* fix: use unique id for breadcrumb context menu drop

* chore: retrigger ci
@openclouders openclouders mentioned this pull request Sep 30, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants