Peach: Local-first video metadata scraper and media manager.
fix(web): 锚定菜单只在页面滚动时关闭,菜单自己滚不关
longmeidao1fb54c7ddd94
diff --git a/docs/STATUS.md b/docs/STATUS.mdindex 25ff2e8ca..ad295b983 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -38,6 +38,7 @@- 统计与口味两页按登录态 Vercel Analytics/Speed Insights 的当前页面重做,排行与数据源共用父网格的引导线。- 口味页顶部给出结论与可点入口:浏览与 Peach 两侧的共同信号、可探索标签、待补证据的下一步动作。- 操作回执统一复用终态 Toast:等待态只在触发按钮内显示 Spinner,用 `aria-busy` 阻止重复请求而不禁用按钮。+- 实体的统称由用户在资料页自选:菜单只列这条实体名下已有的写法,选中的提为规范名、换下的留成别名,扁平投影跟着改;不收自由文本,撞上另一条实体的规范名只报冲突。- 实体链接可安装:`entity_link` 表、`q_entity` 的 `links` 契约、资料页 favicon 与管理页链接管理成套;死链区分「搬走了」和「没了」,`rediscover_entity_links.py` 从站点索引页上溯找新锚。- 外链圆标与厂牌标识取站点自己声明的那份资产,宽扁字标不参加小圆标的竞选;`/logo` 的 `variant` 把厂牌标识分成 `icon` 与 `logo` 两档,只有真有两份时才分岔。- 厂牌标识由契约位 `has_logo` 决定出不出图:没装标识的厂牌一个 `<img>` 都不发,改用首字母底板,不靠 404 摘。diff --git a/tests/test_web_ui.py b/tests/test_web_ui.pyindex 4c7f9ab05..7045821d3 100644--- a/tests/test_web_ui.py+++ b/tests/test_web_ui.py@@ -3911,6 +3911,11 @@ class WebUiSourceTests(unittest.TestCase):self.assertPageContains("menu.hidden=true;menu.style.left='';menu.style.top='';menu.style.maxHeight='';")+ def test_anchored_menu_closes_on_page_scroll_but_not_on_its_own(self):+ # 菜单装不下时本来就要在内部滚;捕获阶段的 scroll 连它自己的也收得到。+ self.assertCode(+ "if(!(event.target instanceof Node&&menu.contains(event.target)))setOpen(false)")+def test_entity_name_picker_keeps_a_touch_target_on_phones(self):self.assertPageContains(".npbtn{width:44px;height:44px}")self.assertPageContains(".npmenu button{min-height:44px}")diff --git a/web/js/ui-components.js b/web/js/ui-components.jsindex 02e111f05..3aa94192a 100644--- a/web/js/ui-components.js+++ b/web/js/ui-components.js@@ -361,7 +361,11 @@ export function wireAnchoredMenu(mount,toggle,menu){menu.style.maxHeight=height+'px';menu.style.left=Math.max(8,Math.min(anchor.right-width,innerWidth-width-8))+'px';menu.style.top=(downward?anchor.bottom+8:anchor.top-8-height)+'px'};- const closeFromViewport=()=>setOpen(false);+ /* 页面滚走了就关掉:菜单固定在视口里,锚点跟着内容跑,留着就悬在半空。+ 菜单自己的滚动不算——它装不下时本来就要在内部滚,滚一下就关等于底下那几项+ 根本够不着。捕获阶段连菜单内部的滚动一并收得到,所以这里必须自己分开。 */+ const closeFromViewport=event=>{+ if(!(event.target instanceof Node&&menu.contains(event.target)))setOpen(false)};const setOpen=open=>{if(open){menu.hidden=false;position();