fix(SelectLite): 下拉位置错位 + 关闭动画 + 滚外部自动收缩 (v1.3.1-7)#426
Merged
Conversation
用户在 macOS 上反馈 LLM provider 下拉 3 个问题: 1. 位置完全错位(popover 跟 trigger 不对齐) 2. 没有关闭动画 3. 在 popover 外滚动应自动收缩,但当前会跟着 trigger 重定位 [位置错位根因] positionPopover useCallback deps [],useLayoutEffect 在 open=true 时 fire 一次 —— 此时 popoverRef.current 还没挂载,popoverWidth 用 trigger.width 兜底。 Popover mount 后真实宽度 ≠ trigger 宽(长选项撑大),但 effect 不再重算。 修法:popoverRef 改用 callback ref,每次 popover DOM mount 时 RAF 推到下一帧 重算 anchor,拿到真实 popover 宽。同时 positionPopover 用 max(trigger 宽, popoverRect 宽) 保证 popoverWidth 不低估。 [滚动外部 → 关闭] 之前 useLayoutEffect 监听 scroll 事件做 reposition。改成监听 'scroll' + 'wheel' capture phase,target 在 popover 内(popoverRef.contains)保留打开(长列表 内部 scroll 不关),target 在外部 → closeMenu。同时 window resize 也强制关闭。 [关闭动画] 加 leaving state 让 popover 在 unmount 前播 ol-select-pop-out 反向 keyframe (opacity 1→0 + translateY 0→-4 + scale 1→.98,跟入场对偶)。140ms 后真正 unmount + 清 anchor / highlight。
appergb
pushed a commit
that referenced
this pull request
May 12, 2026
…ing 黑底 [bump] v1.3.1-6 → v1.3.1-7。本版本含 PR #426 merged(SelectLite 位置/动画/ 滚外关)+ 本 commit 的两件用户实机 surface: [Capsule 磨砂玻璃 Windows 路径打开] 之前 Capsule.tsx Windows 路径 useBackdrop = os !== 'win' 强制关掉 backdrop-filter, 让 Windows 胶囊看上去就是白色 pill 没玻璃感。WebView2 现在支持 backdrop-filter, 打开让 Windows 玻璃感对齐 macOS: - Pill: backdrop-filter blur(28px) saturate(180%) - CircleButton (cancel): blur(12px) saturate(160%) [Thinking 字体重做] - 字号 17 保持,字重 700 → 600 稍细 - 底字浅亮黄 #FCD34D → var(--ol-ink) 黑(用户:"亮黄太显眼,黑底更稳") - 中段扫光 var(--ol-blue) 深蓝不变(继续作为高对比"滑动"标志)
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
appergb
pushed a commit
that referenced
this pull request
May 12, 2026
[CRITICAL fix: SelectLite 所有下拉打不开] v1.3.1-7 (PR #426) 我引入了 deadlock: - anchor 初始 null + portal 条件 `open && anchor && createPortal(...)` - 我删了 useLayoutEffect 在 open=true 时调 positionPopover - 改成 popoverRef callback ref(只在 DOM mount 时 fire) - 但 popover DOM 挂载条件依赖 anchor 非 null → anchor 永 null → 死锁 用户报"所有竖向切换横幅的界面全都打不开了"——LLM 供应商 / ASR 提供商 / paste shortcut / mirror / language / polish mode 等 SelectLite 下拉全部 点击无反应。这是我的 review 失误,深表歉意。 修:加回 useLayoutEffect 在 open=true 时调 positionPopover 一次(用 trigger 宽 fallback 立即设 anchor),保留 callback ref RAF 在 popover mount 后用 真实宽精确重定位。两步合并:anchor 立即不为 null → portal 渲染 → callback ref 触发 → 重新精确定位。 [玻璃统一处理] 用户:"现在完全没有磨砂玻璃的效果,应该把底下的细控组件、边栏以及盖栏 等设置的边栏采用同一种方式处理"。 之前 main content (`<main>`) 用 `var(--ol-surface)` 完全不透明白底,跟透明 sidebar 视觉割裂。改成 `rgba(255,255,255,0.62)` + `backdrop-filter blur(18px) saturate(170%)`,跟 sidebar 一起坐在 WindowChrome 磨砂底板上,全应用一块 连续玻璃。 [版本] 1.3.1-7 → 1.3.1-8,6 处版本号同步。
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.
User description
v1.3.1-6 装机后用户报 macOS LLM provider 下拉 3 个问题。一次性收。
1. 位置错位(根因)
positionPopoveruseCallback deps[],useLayoutEffect在open=truefire 一次 —— 此时 popoverRef.current 还没挂载,popoverWidth 用 trigger.width 兜底。Popover mount 后真实宽度(长选项撑大)≠ trigger 宽,但 effect 不再重算,位置漂掉。修:popoverRef 改 callback ref,每次 mount 时 RAF 推到下一帧重算 anchor,拿到真实宽。
Math.max(popoverRect.width, rect.width)保证 popoverWidth 不低估。2. 滚外部应自动收缩
之前 scroll 触发 reposition。改成 capture phase 监听
scroll+wheel—— popover 内部 scroll(长列表)保留打开,外部 scroll/wheel 直接closeMenu()。window resize 也强制关闭。3. 关闭动画
加
leavingstate,popover unmount 前播ol-select-pop-out反向 keyframe(opacity 1→0 + translateY 0→-4 + scale 1→.98,跟入场对偶),140ms 后真正卸载。Test plan
PR Type
Bug fix, Enhancement
Description
Fix popover misalignment: callback ref + requestAnimationFrame recalculates position with real popover width
Add exit animation:
leavingstate triggers reverse keyframe, delays unmount by 140msAuto-close on external scroll/wheel/resize: capture-phase listeners close menu; internal scroll preserved
Remove
useLayoutEffectrepositioning; streamline event handlingDiagram Walkthrough
File Walkthrough
SelectLite.tsx
Fix SelectLite positioning, close animation, and external scroll closeopenless-all/app/src/components/ui/SelectLite.tsx
popoverRefwith callback ref that usesrequestAnimationFrameon mount to fix misalignment when popover content is wider than
trigger
leavingstate to delay unmount until 140ms exit animation(
ol-select-pop-out) completesscroll/wheellisteners to close popover when scrolling outside; added
resizelistener to force close
useLayoutEffectfor positioning and its reflow handler;cleaned up imports and comments
global.css
Add exit animation keyframes for SelectLite popoveropenless-all/app/src/styles/global.css
@keyframes ol-select-pop-outfor reverse exit animation: fadesout, moves up 4px, scales to 0.98