🐛 修复 Edge Android 移动端 popup 适配问题 (#686)#1507
Merged
Merged
Conversation
两处移动端问题,根因不同分别修复: 1. popup 右侧留白:popup.html 把 html/body 宽度写死 320px。桌面端 popup 视口宽度恒等于 body 宽度(320px),移动端被强制撑满设备宽度(≥360px),固定 320px 导致右侧空白。改用媒体查询 @media (min-width:340px) 在移动端切换为 width:100%、max-height:none,桌面端不命中、行为零变化。 2. 点击「设置」等打不开内部页:window.open 在 Edge Android 上无法打开 chrome-extension:// 内部页(外部 https 网址正常)。将 6 处打开 /src/*.html 的 window.open 改为 openInCurrentTab(chrome.tabs.create):popup 的设置/新建 脚本、ScriptMenuList 的编辑/用户配置、MainLayout 拖拽导入、Tools 数据导入。 openInCurrentTab 增加返回创建出来的标签(chrome.tabs.Tab|undefined),供 MainLayout 判断是否成功打开;同步补充单元测试,并让 chrome-extension-mock 的 tabs.create 返回 Promise 以贴近真实 MV3。
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.
Checklist / 检查清单
Description / 描述
close #686
修复 Edge Android 移动端两处 UI 适配问题(根因不同,分别处理):
1. popup 右侧留白
popup.html把html/body宽度写死为320px。桌面端 popup 的视口宽度恒等于 body 宽度(320px),而移动端被浏览器强制撑满设备宽度(≥360px),固定 320px 就在右侧留下空白。改用媒体查询——桌面端不命中、行为零变化,移动端切换为width:100%:阈值
340px卡在桌面 320px 与最小手机宽度(≥360px)之间。2. 点击「设置」等内部页打不开
window.open在 Edge Android 上打不开chrome-extension://内部页(外部https网址正常,所以「获取脚本」能用)。将 6 处打开/src/*.html的window.open改为openInCurrentTab(底层chrome.tabs.create,扩展 API 不受移动端window.open限制):popup/App.tsxcomponents/ScriptMenuListcomponents/layout/MainLayoutoptions/routes/Tools外部
https的window.open(反馈、文档、GitHub、获取脚本等)保持不变。openInCurrentTab增加返回创建出来的标签(chrome.tabs.Tab | undefined),供MainLayout判断安装页是否成功打开;同步补充单元测试,并让chrome-extension-mock的tabs.create返回Promise以贴近真实 MV3。测试 / Testing
pnpm test958 通过(含新增openInCurrentTab用例);tsc --noEmit、eslint通过。window.open → chrome.tabs.create的改动建议在 Edge Android 实机再回归确认一次。备注
本 PR 解决 #686 的「左右留白 / 点击无法打开页面」。Issue 中另提到的脚本列表行内开关/图标/标题拥挤属于行内布局 polish(
ScriptMenuList的 flex 布局),与本次根因不同,建议单独跟进。Screenshots / 截图