Skip to content

🐛 fix(mobile): render topic menus and rename popovers inside active overlay container#12477

Merged
Innei merged 1 commit into
lobehub:canaryfrom
Zhouguanyang:fix/mobile-topic-dropdown
Mar 21, 2026
Merged

🐛 fix(mobile): render topic menus and rename popovers inside active overlay container#12477
Innei merged 1 commit into
lobehub:canaryfrom
Zhouguanyang:fix/mobile-topic-dropdown

Conversation

@Zhouguanyang

@Zhouguanyang Zhouguanyang commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

💻 Change Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • ✅ test
  • 📝 docs
  • 🔨 chore

🔗 Related Issue

🔀 Description of Change

This PR fixes mobile web topic action menus and rename popovers that could render outside the active overlay and become unreliable to interact with.

  • Introduce a shared overlay container context for mobile topic overlays
  • Capture the active overlay container from both SideBarDrawer and TopicModal
  • Render topic and thread action menus inside the active overlay container
  • Render topic and thread rename popovers inside the active overlay container
  • Avoid click-through and overlay layering issues on mobile
  • Keep desktop behavior unchanged

🧪 How to Test

  1. Open the web app in a mobile viewport, or use a phone browser
  2. Enter chat and open the topic panel from the header entry point
  3. Tap ··· on both a topic item and a thread item
  4. Verify the action menu is clickable and actions work normally, including destructive actions like delete
  5. Click Rename for both a topic item and a thread item
  6. Verify the rename input appears correctly inside the visible overlay and is fully interactive
  7. Open the topic panel from the other mobile entry point and repeat the same checks
  8. Verify desktop web behavior remains unchanged
  • Tested locally
  • Added/updated tests
  • No tests needed

📸 Screenshots / Videos

Topic Dropdown Menus Rename Popovers
ecdcd341-9c9f-4811-8192-a14ba9461ae4 354bebb8-c1ba-409e-bf04-e27e4989b406

📝 Additional Information

  • No breaking changes
  • Scope is limited to mobile topic menu and rename popover interaction behavior

@vercel

vercel Bot commented Feb 25, 2026

Copy link
Copy Markdown

@Zhouguanyang is attempting to deploy a commit to the LobeHub OSS Team on Vercel.

A member of the Team first needs to authorize it.

@sourcery-ai

sourcery-ai Bot commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Makes mobile topic and thread action dropdown menus controlled and renders their popups into the active drawer portal container to fix interaction issues on mobile while leaving desktop behavior unchanged.

Sequence diagram for mobile topic/thread dropdown menu open with drawer portal

sequenceDiagram
  actor MobileUser
  participant Actions
  participant useServerConfigStore
  participant DOM
  participant DropdownMenu

  MobileUser->>Actions: tap MoreHorizontalIcon
  Actions->>useServerConfigStore: get isMobile
  useServerConfigStore-->>Actions: mobile
  Actions->>Actions: setOpen(true)
  Actions->>Actions: compute portalContainer (useMemo)
  Actions->>DOM: querySelectorAll(.ant-drawer-content-wrapper)
  DOM-->>Actions: NodeList drawerContainers
  Actions->>Actions: select topDrawerContainer
  Actions->>DOM: querySelector(.ant-drawer-section)
  DOM-->>Actions: portalContainer
  Actions->>DropdownMenu: render with
  Note over Actions,DropdownMenu: props: items, open, onOpenChange, portalProps{container:portalContainer}
  MobileUser->>DropdownMenu: tap menu item
  DropdownMenu-->>Actions: onOpenChange(false)
  Actions->>Actions: setOpen(false)
  Actions->>Actions: recompute portalContainer undefined
Loading

Updated class diagram for Actions components controlling mobile dropdown portal

classDiagram
  class Actions {
    +dropdownMenu DropdownItem[] | function
    -mobile boolean
    -open boolean
    -portalContainer HTMLElement
    +render(): JSXElement
  }

  class useServerConfigStore {
    +isMobile boolean
    +getState(selector): any
  }

  class DropdownMenu {
    +items DropdownItem[] | function
    +open boolean
    +portalProps object
    +onOpenChange(nextOpen): void
  }

  class ActionIcon {
    +icon IconType
    +size string
  }

  Actions ..> useServerConfigStore : uses
  Actions ..> DropdownMenu : renders
  Actions ..> ActionIcon : renders
Loading

File-Level Changes

Change Details Files
Make topic and thread action dropdown menus controlled and portal them into the active drawer on mobile.
  • Switch DropdownMenu usage from uncontrolled to controlled by adding local open state and onOpenChange handler.
  • Use useServerConfigStore to detect mobile environment via isMobile.
  • Compute a portal container with useMemo that, on mobile and when open, finds the topmost .ant-drawer-content-wrapper and prefers its .ant-drawer-section as the render target.
  • Pass portalProps.container to DropdownMenu when a drawer container is resolved, falling back to default behavior otherwise.
  • Apply the same controlled + portal behavior consistently across agent and group topic item and thread item action components.
src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/List/Item/Actions.tsx
src/app/[variants]/(main)/agent/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/Actions.tsx
src/app/[variants]/(main)/group/_layout/Sidebar/Topic/List/Item/Actions.tsx
src/app/[variants]/(main)/group/_layout/Sidebar/Topic/TopicListContent/ThreadList/ThreadItem/Actions.tsx

Possibly linked issues

  • #next-318: PR changes mobile topic dropdown rendering/portal, directly targeting the unresponsive mobile topic dropdown reported in the issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Zhouguanyang Zhouguanyang changed the title 🐛 fix(mobile): render mobile topic dropdown menus inside drawer portal 🐛 fix(mobile): render topic dropdown menus inside drawer portal Feb 25, 2026

@sourcery-ai sourcery-ai Bot left a comment

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.

Hey - I've left some high level feedback:

  • The Actions components across agent/group topic and thread lists now duplicate the same mobile/open/portalContainer logic; consider extracting this into a shared hook or utility (e.g. useDrawerDropdownPortal) to keep behavior consistent and easier to maintain.
  • Access to document inside useMemo is guarded, but since this is layout code that may shift between SSR and CSR, it may be safer to centralize the document-based DOM querying in a browser-only utility/hook to avoid accidental reuse in non-DOM contexts.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `Actions` components across agent/group topic and thread lists now duplicate the same `mobile`/`open`/`portalContainer` logic; consider extracting this into a shared hook or utility (e.g. `useDrawerDropdownPortal`) to keep behavior consistent and easier to maintain.
- Access to `document` inside `useMemo` is guarded, but since this is layout code that may shift between SSR and CSR, it may be safer to centralize the `document`-based DOM querying in a browser-only utility/hook to avoid accidental reuse in non-DOM contexts.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov

codecov Bot commented Feb 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.32%. Comparing base (88935d8) to head (6c7b963).
⚠️ Report is 6 commits behind head on canary.

Additional details and impacted files
@@            Coverage Diff            @@
##           canary   #12477     +/-   ##
=========================================
  Coverage   74.32%   74.32%             
=========================================
  Files        1531     1531             
  Lines      125642   125642             
  Branches    13874    16515   +2641     
=========================================
  Hits        93384    93384             
  Misses      32147    32147             
  Partials      111      111             
Flag Coverage Δ
app 67.33% <ø> (ø)
database 97.89% <ø> (ø)
packages/agent-runtime 89.60% <ø> (ø)
packages/context-engine 83.53% <ø> (ø)
packages/conversation-flow 92.36% <ø> (ø)
packages/file-loaders 87.02% <ø> (ø)
packages/memory-user-memory 66.68% <ø> (ø)
packages/model-bank 99.84% <ø> (ø)
packages/model-runtime 84.77% <ø> (ø)
packages/prompts 74.60% <ø> (ø)
packages/python-interpreter 92.90% <ø> (ø)
packages/ssrf-safe-fetch 0.00% <ø> (ø)
packages/utils 90.09% <ø> (ø)
packages/web-crawler 88.81% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Store 66.21% <ø> (ø)
Services 49.89% <ø> (ø)
Server 69.01% <ø> (ø)
Libs 42.20% <ø> (ø)
Utils 91.41% <ø> (ø)
🚀 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.

@Zhouguanyang Zhouguanyang force-pushed the fix/mobile-topic-dropdown branch from 23d9909 to 2acc548 Compare March 19, 2026 08:25
<DropdownMenu
items={dropdownMenu}
open={open}
portalProps={portalContainer ? { container: portalContainer } : undefined}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

使用 querySelector 的写法并不是很好,因为它脱离了 React 组件的控制。一旦这个上游组件没有在 layout 完成,或者遇到了 remount 的情况,那么这里的焦点就会丢失,这个元素也会丢失。

所以我建议你这里使用 React 的 Context 进行传递 DrawerContent 的 Element Ref 作为 State。

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.

已修改,顺便把重命名也给修了

@Zhouguanyang Zhouguanyang changed the title 🐛 fix(mobile): render topic dropdown menus inside drawer portal 🐛 fix(mobile): render topic dropdown menus inside active overlay container Mar 20, 2026
@Zhouguanyang Zhouguanyang force-pushed the fix/mobile-topic-dropdown branch from 2acc548 to 2fd8000 Compare March 20, 2026 14:05
@Zhouguanyang

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Zhouguanyang Zhouguanyang force-pushed the fix/mobile-topic-dropdown branch from 2fd8000 to 6c7b963 Compare March 20, 2026 14:44
@Zhouguanyang Zhouguanyang changed the title 🐛 fix(mobile): render topic dropdown menus inside active overlay container 🐛 fix(mobile): render topic menus and rename popovers inside active overlay container Mar 20, 2026
@Zhouguanyang

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@Zhouguanyang Zhouguanyang requested a review from Innei March 20, 2026 14:50
@Innei Innei merged commit f916613 into lobehub:canary Mar 21, 2026
23 of 27 checks passed
@lobehubbot

Copy link
Copy Markdown
Member

❤️ Great PR @Zhouguanyang ❤️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.

@Zhouguanyang Zhouguanyang deleted the fix/mobile-topic-dropdown branch March 21, 2026 17:16
timoshinoleg-eng pushed a commit to timoshinoleg-eng/lobe-chat-fork that referenced this pull request Mar 21, 2026
ONLY-yours added a commit that referenced this pull request Mar 27, 2026
# 🚀 release: 20260326

This release includes **91 commits**. Key updates are below.


- **Agent can now execute background tasks** — Agents can perform
long-running operations without blocking your conversation.
[#13289](#13289)
- **Better error messages** — Redesigned error UI across chat and image
generation with clearer explanations and recovery options.
[#13302](#13302)
- **Smoother topic switching** — No more full page reloads when
switching topics while an agent is responding.
[#13309](#13309)
- **Faster image uploads** — Large images are now automatically
compressed to 1920px before upload, reducing wait times.
[#13224](#13224)
- **Improved knowledge base** — Documents are now properly parsed before
chunking, improving retrieval accuracy.
[#13221](#13221)

### Bot Platform

- **WeChat Bot support** — You can now connect LobeChat to WeChat, in
addition to Discord.
[#13191](#13191)
- **Richer bot responses** — Bots now support custom markdown rendering
and context injection.
[#13294](#13294)
- **New bot commands** — Added `/new` to start fresh conversations and
`/stop` to halt generation.
[#13194](#13194)
- **Discord stability fixes** — Fixed thread creation issues and Redis
connection drops.
[#13228](#13228)
[#13205](#13205)

### Models & Providers

- **GLM-5** is now available in the LobeHub model list.
[#13189](#13189)
- **Coding Plan providers** — Added support for code planning assistant
providers. [#13203](#13203)
- **Tencent Hunyuan 3.0 ImageGen** — New image generation model from
Tencent. [#13166](#13166)
- **Gemini content handling** — Better handling when Gemini blocks
content due to safety filters.
[#13270](#13270)
- **Claude token limits fixed** — Corrected max window tokens for
Anthropic Claude models.
[#13206](#13206)

### Skills & Tools

- **Auto credential injection** — Skills can now automatically request
and use required credentials.
[#13124](#13124)
- **Smarter tool permissions** — Built-in tools skip confirmation for
safe paths like `/tmp`.
[#13232](#13232)
- **Model switcher improvements** — Quick access to provider settings
and visual highlight for default model.
[#13220](#13220)

### Memory

- **Bulk delete memories** — You can now delete all memory entries at
once. [#13161](#13161)
- **Per-agent memory control** — Memory injection now respects
individual agent settings.
[#13265](#13265)

### Desktop App

- **Gateway connection** — Desktop app can now connect to LobeHub
Gateway for enhanced features.
[#13234](#13234)
- **Connection status indicator** — See gateway connection status in the
titlebar. [#13260](#13260)
- **Settings persistence** — Gateway toggle state now persists across
app restarts. [#13300](#13300)

### CLI

- **API key authentication** — CLI now supports API key auth for
programmatic access.
[#13190](#13190)
- **Shell completion** — Tab completion for bash/zsh/fish shells.
[#13164](#13164)
- **Man pages** — Built-in manual pages for CLI commands.
[#13200](#13200)

### Security

- **XSS protection** — Sanitized search result image titles to prevent
script injection.
[#13303](#13303)
- **Workflow hardening** — Fixed potential shell injection in release
automation. [#13319](#13319)
- **Dependency update** — Updated nodemailer to address security
advisory. [#13326](#13326)

### Bug Fixes

- Fixed skill page not redirecting correctly after import.
[#13255](#13255)
[#13261](#13261)
- Fixed token counting in group chats.
[#13247](#13247)
- Fixed editor not resetting when switching to empty pages.
[#13229](#13229)
- Fixed manual tool toggle not working.
[#13218](#13218)
- Fixed Search1API response parsing.
[#13207](#13207)
[#13208](#13208)
- Fixed mobile topic menus rendering issues.
[#12477](#12477)
- Fixed history count calculation for accurate context.
[#13051](#13051)
- Added missing Turkish translations.
[#13196](#13196)

### Credits

Huge thanks to these contributors:

@bakiburakogun @hardy-one @Zhouguanyang @sxjeru @hezhijie0327 @arvinxx
@cy948 @CanisMinor @Innei @lijian @lobehubbot @neko @rdmclin2
@rivertwilight @tjx666
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.

3 participants