Skip to content

[BUG] 底部錨定的字幕會在滑鼠 hover 時上飄,導致無法選取文字(含claude 建議) #2031

Description

@oltervir-cmyk

Before you report

  • I have searched existing issues to avoid duplicates
  • I have tried with the latest available version (or can reproduce on latest)

Current vs. Expected behavior

目前行為

在 YouTube 上,字幕區塊錨定在底部(bottom anchor)。滑鼠一進入播放器,YouTube 會移除 ytp-autohide,擴充的 controlsVisible 變成 true,字幕區塊就會往上位移,幅度剛好等於控制列的高度(我這邊播放器高 1013px、控制列 59px,也就是 +5.82%)。

問題在於字幕只有在滑鼠靠近它的時候才移動,等於是個會逃跑的目標:

  • 無法選取/複製字幕文字 —— 游標一靠過去,字幕就跳走了。
  • 字幕容器帶有 pointer-events-autocursor-text,會壓在 YouTube 控制列上方,導致底下的進度條和按鈕很難點到。

期望行為

字幕應該固定在我拖曳設定的位置。這個控制列位移應該可以關閉(提供設定項),或者至少在游標停在字幕區塊上時不要套用。

根因(來自原始碼)

src/entrypoints/subtitles.content/ui/use-vertical-drag.ts

const controlsOffsetPercent =
  controlsVisible && position.anchor === "bottom" && windowStyle.height > 0
    ? (controlsHeight / windowStyle.height) * 100
    : 0

const positionStyle = position.anchor === "top"
  ? { top: `${position.percent}%`, bottom: "unset" }
  : { bottom: `${position.percent + controlsOffsetPercent}%`, top: "unset" }

再加上 subtitles-view.tsx 裡的 transition-[top,bottom] duration-200,就造成每次 hover 都會有 200ms 的上飄動畫。

src/types/config/subtitles.tsvideoSubtitlesSchema 只開放了 position,使用者沒有任何方法可以關掉這個位移。

建議修法

videoSubtitlesSchema 加一個布林值(例如 followControls,預設 true 以保持現有行為)來控制 controlsOffsetPercent 是否生效。已經自行把字幕拖離控制列的使用者就可以把它關掉。

To Reproduce

  1. 開啟任一 YouTube 影片(例如 https://www.youtube.com/watch?v=S2BQmy3T1Gw),並啟用 Read Frog 字幕。
  2. 把字幕區塊拖到播放器底部(bottom anchor,position.percent 接近 0)。
  3. 把滑鼠移開播放器,等 YouTube 控制列自動隱藏。
  4. 滑鼠移回播放器內,嘗試用游標選取字幕文字。
  5. 觀察結果:控制列出現的同時,字幕區塊往上位移一個控制列的高度,選取動作落在空白處。

在頁面上實測驗證:

// 控制列隱藏時
box.getAttribute('style') // => "bottom: 0%; top: unset;"
// 控制列顯示時
box.getAttribute('style') // => "bottom: 5.82%; top: unset;"   // 59px / 1013px

Which area(s) are affected? (Select all that apply)

Website

Extension version (if applicable)

1.45.1

Provide environment information

- OS: macOS 26 (Darwin 27.0.0)
- Browser: Google Chrome <請填入 chrome://version 的版本>
- Extension channel/version: Chrome Web Store <請填入>
- Website: https://www.youtube.com/watch?v=S2BQmy3T1Gw,觀察時間 2026-08-03

Additional context

可在 youtube.com/watch 穩定重現。只要是 bottom anchor 都會套用這個位移,字幕越靠近播放器底部影響越嚴重。

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions