Skip to content

Marketplace catalog loses keyboard focus when the header hides below the desktop breakpoint #46146

Done

Description

@hyoban

Affected files

  • web/app/components/plugins/marketplace/home/home-catalog-navigation.tsx
  • web/app/components/plugins/marketplace/home/home-catalog-focus.ts
  • web/app/components/plugins/marketplace/home/home-sticky.module.css

Reproduction

  1. Open the standalone marketplace at a desktop width (at least 880px).
  2. Scroll until the catalog links are pinned into the header.
  3. Use Tab to focus Plugins or Templates in that header.
  4. Narrow the viewport below 880px, hiding the header catalog slot.

Expected

Focus moves to the equivalent in-flow catalog link, which remains usable on mobile.

Actual

The focused header link disappears and Chromium moves focus to document.body. The catalog links return to the in-flow slot, but keyboard users lose their place. Desktop scroll handoff and mobile-to-desktop resize preserve focus correctly.

Regression evidence

web/app/components/plugins/marketplace/home/__tests__/home-catalog-handoff.browser.spec.tsx, case keeps real catalog links keyboard-operable as the mobile header appears and disappears, reproduces this with real links, native Tab, and actual viewport changes. It will remain it.fails in the test cleanup PR. No production changes are included there.

Test cleanup: #46148

Activity

  1. dosubot commented on Nov 12, 2026

    @dosubot

    This points to a focus-capture timing gap: the mobile CSS applies display: none to the header tabs, while updatePinnedState() only captures the focused link when its resize/media-query callback runs. If Chromium has already moved focus to body, getFocusedCatalogTabHref('header') returns null, leaving the layout effect with nothing to restore. That matches the one-way failure you describe. [1] [2] [3]

    A likely fix direction is to track the focused catalog link’s href while the header is still visible, then use that identity for the breakpoint handoff after the content slot becomes non-inert. The existing destination helper already matches by href and uses focus({ preventScroll: true }); the missing piece appears to be preserving the source identity before CSS hides it, rather than changing destination lookup. [2] [3]

    To reply, just mention @dosu.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about dify

  2. GYJ99 commented on Nov 12, 2026

    @GYJ99

    Hi @hyoban and maintainers — I can take a focused production fix for #46146, separate from the Browser Mode migration in #46148. If nobody is already working on the behavior fix, could you assign this issue to @GYJ99?

    I reviewed the issue, current navigation/focus helpers, the linked test PR, the contribution guide, and related PRs. The likely gap is timing: when the desktop header slot becomes hidden below 880px, Chromium may move focus to body before updatePinnedState() reads the focused header link. I'd preserve the focused catalog link's href while it is still visible and restore focus to the corresponding in-flow link after the breakpoint handoff, without forcing focus for unrelated interactions or changing scroll position.

    I would use the existing #46148 Chromium it.fails scenario as the regression owner once it lands, verify native Tab and both resize directions, and run focused browser tests plus Web lint/type checks before submitting a PR. This is a source-based plan; I have not claimed a completed local test run. Happy to coordinate if a production fix is already in progress.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions