Skip to content

armgit / peach

Public Imported from GitHub
0

Peach: Local-first video metadata scraper and media manager.

fix(web): 下拉每一项的站标和触发器同列

longmeidao74056dddc545
diff --git a/tests/test_web_ui.py b/tests/test_web_ui.py
index 93e905083..cd74472fa 100644
--- a/tests/test_web_ui.py
+++ b/tests/test_web_ui.py
@@ -3691,6 +3691,20 @@ class WebUiSourceTests(unittest.TestCase):
self.assertPageContains(
".gselectfield>svg{width:16px;height:16px;flex:none;stroke:currentColor;fill:none;color:var(--muted)}")
+ def test_a_dropdown_row_puts_its_mark_in_the_same_column_as_the_trigger(self):
+ """展开下拉时站标不挪位:面板每一行的图标和触发器里那一枚落在同一列。
+
+ 选中态只有填充,行首不留勾的位置;行的 6px 内边距加上 `.popmenu` 自己的 6px 正好
+ 等于触发器的 12px,两处图标于是对齐到一像素(复现页实测都是距左 13px,含 1px 边框)。
+ """
+ self.assertCode('aria-selected="${String(value)===String(chosen[0])}" tabindex="-1">'
+ '<span data-select-content>')
+ self.assertPageContains("padding:0 6px;border:0;border-radius:var(--control-radius);"
+ "background:transparent;color:var(--ink-2);")
+ self.assertPageContains("height:var(--control-h);padding:0 10px 0 12px;")
+ self.assertPageLacks('.popmenu.gselectmenu button[aria-selected="true"]>svg',
+ "选中项靠填充读出来,行首不画勾")
+
def test_settings_panel_fits_the_visible_viewport_on_ios(self):
"""iOS 上 `vh` 算的是不减地址栏的「大视口」。
diff --git a/web/css/01-base.css b/web/css/01-base.css
index 7d79ad874..0009793ce 100644
--- a/web/css/01-base.css
+++ b/web/css/01-base.css
@@ -477,13 +477,13 @@ body.settings-open>.ovtrack.page,body.photolight-open>.ovtrack.page{display:none
.gselectfield[aria-expanded="true"]{box-shadow:inset 0 0 0 2px var(--color-border-button-active)}
.gselectfield:disabled{background:var(--surface);color:var(--muted);cursor:not-allowed}
.gselectfield:focus-visible{outline:2px solid var(--tungsten);outline-offset:2px}
+/* 行的左内边距加上 .popmenu 自己的 6px 等于触发器的 12px:每一项的站标和触发器里那一枚
+ 站在同一列上,下拉展开时图标不挪位。 */
.popmenu.gselectmenu button{display:flex;align-items:center;gap:8px;width:100%;min-height:var(--control-h);
- padding:0 8px;border:0;border-radius:var(--control-radius);background:transparent;color:var(--ink-2);
+ padding:0 6px;border:0;border-radius:var(--control-radius);background:transparent;color:var(--ink-2);
font:inherit;font-size:var(--fs-md);text-align:left;cursor:pointer}
.popmenu.gselectmenu button:hover{background:var(--hover);color:var(--ink)}
-.popmenu.gselectmenu button>svg{width:16px;height:16px;flex:none;visibility:hidden;stroke:currentColor;fill:none}
.popmenu.gselectmenu button[aria-selected="true"]{background:var(--hover);color:var(--ink)}
-.popmenu.gselectmenu button[aria-selected="true"]>svg{visibility:visible}
/* 工具行收窄:宽度不够时,带图标又带文字的按钮和下拉只留图标,而不是把半排控件
推到第二行去——一行控件断成两行以后,读的人要先认出哪几个原本是一组的。
diff --git a/web/js/ui-components.js b/web/js/ui-components.js
index 8ded08f81..a24912282 100644
--- a/web/js/ui-components.js
+++ b/web/js/ui-components.js
@@ -1211,8 +1211,12 @@ export function wireContextCard(mount,trigger,panel){
要么只能用 `color-scheme` 整个按回深色——设置面板里那七个此前就是被按成深色的,
白底页面上七块黑。2026-09-04 实测 vercel.com 后台:整站没有一个原生下拉,触发器是
button,面板是自绘 listbox,面板底色就是页面底色(浅色下纯白 --ds-background-100),
- 行高 36px、圆角 6px、行内边距 0 8px,悬停与选中都是 5% 中性填充。Peach 的行高走站内
- 已有的 --control-h(38px),面板与定位复用 .popmenu 和 wireAnchoredMenu。
+ 行高 36px、圆角 6px、行内边距 0 8px,悬停与选中都是 5% 中性填充,选中项没有勾。Peach
+ 的行高走站内已有的 --control-h(38px),面板与定位复用 .popmenu 和 wireAnchoredMenu。
+
+ 选中态只有填充,行内也就没有一枚勾要占位:行首腾出来的那一格正好让每一项的站标和
+ 触发器里那一枚落在同一列上。面板的左内边距(.popmenu 的 6px 加行的 6px)按触发器的
+ 12px 凑,两处图标于是对齐到一像素。
`value`、`disabled` 和 `change` 三样按原生 select 的写法留在根元素上:调用方读写它跟
读写原生下拉一样,换掉的只是画法。 */
@@ -1225,7 +1229,7 @@ export function selectFieldHtml(options,current,{label='',attr='',className=''}=
const content=([,text,mark])=>`${selectOptionIconHtml(mark)}${esc(text)}`;
const rows=options.map(([value,text,mark])=>
`<button type="button" role="option" data-select-option="${esc(value)}"
- aria-selected="${String(value)===String(chosen[0])}" tabindex="-1">${icon('check')}<span data-select-content>${content([value,text,mark])}</span></button>`).join('');
+ aria-selected="${String(value)===String(chosen[0])}" tabindex="-1"><span data-select-content>${content([value,text,mark])}</span></button>`).join('');
return `<div class="gselect${className?` ${esc(className)}`:''}" ${attr}>
<button type="button" class="gselectfield" data-select-trigger aria-haspopup="listbox"
aria-expanded="false" aria-label="${esc(label)}"><span data-select-label>${content(chosen)}</span>${icon('chevron-down')}</button>