fix(mobile): restore right sidebar entry - #126
Merged
shaobeichen merged 1 commit intoSep 16, 2026
Merged
Conversation
Restore the native mobile right-sidebar control hidden by a brittle header selector, while adding a persisted switch for compact layouts. Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
data-conversation-header-corner标记替代依赖 DOM 顺序的选择器。Fixes #122.
背景
在移动端使用 DSH 时,底部面板通常用于终端。需要查看会话信息或其他右边栏内容时,原生右边栏入口会更加方便。
普通手机的横向空间有限,部分用户可能更偏好紧凑的标题栏;折叠屏展开后通常具有更充足的左右空间,可以方便地同时使用终端底栏和右边栏。
因此,本 PR 在恢复原生右边栏入口的同时增加一个设置开关:
问题原因
Issue #122 指出,移动端样式使用了以下结构选择器:
[data-phase] header > :first-child > :last-child该规则的注释表示它用于隐藏
headerUtilities。但在 DSH 0.1.5 中,标题栏 DOM 结构已经变化,:last-child实际命中的是headerCorner。DSH 原生右边栏展开按钮注册在:
conversation.session.header.corner因此,这条规则产生了两个问题:
headerUtilities。这属于依赖 DOM 子元素顺序导致的兼容性 bug。
修复方式
本 PR 不再通过
:last-child推断标题栏元素,而是使用宿主提供的稳定属性:data-conversation-header-corner右边栏入口默认保持显示。用户关闭“手机端右边栏”设置后,Pocket 才会通过该稳定属性隐藏入口。
开启右边栏时还会调整 Files 按钮位置,避免两个右上角按钮重叠。
右栏面板本身继续使用 DSH 原生行为:
实现
mobileRightbarEnabled持久化设置,默认true。mobile.rightbar.setEnabledRPC。pocket.status返回当前右边栏设置。兼容性
Test plan
npm run build:clientnpm testpocket.status正确同步headerCorner🤖 Generated with Claude Code