Skip to content

feat(reader): let the mobile reader replay its gesture hint - #550

Merged
mudream4869 merged 1 commit into
devfrom
mudream4869/reader-gesture-hint-recall
Aug 29, 2026
Merged

feat(reader): let the mobile reader replay its gesture hint#550
mudream4869 merged 1 commit into
devfrom
mudream4869/reader-gesture-hint-recall

Conversation

@mudream4869

Copy link
Copy Markdown
Member

問題

行動版閱讀器的手勢說明(點中央開工具列、左右滑翻章)一台裝置只顯示一次onMounted 讀到 reader-mobile-gesture-hint-seen 就直接 return,而寫入旗標與顯示提示是同一次進入書本時發生的,之後整個閱讀器沒有任何說明入口,錯過就只能亂試重新發現。

改法

在工具列尾端加一顆「?」按鈕,把首次自動顯示與手動叫出收斂到同一個 showHint():重設既有 timer、顯示提示、4 秒後自動收起。onMounted 的旗標判斷與寫入邏輯完全沒動,只是改成呼叫 showHint()

提示原本固定在畫面底部 28px,那正是工具列(bottom 10px、高 60px)的位置——從工具列叫出來會被自己的按鈕蓋住,所以 chrome 顯示時多掛一個 mobile-reader-hint-above-chrome 把它抬到 82px。

修在 MobileReaderView.vue 這層而不是抽共用元件:提示、旗標、timer 三者本來就都是這個元件的私有狀態,加一顆按鈕不需要跨層。按鈕文字用「?」而非新增 icon,跟工具列現有的 A−A+Aa 文字按鈕一致,也不必動 icons/registry.ts

驗收

卡片驗收條件 驗證方式
已看過提示的使用者仍能主動叫出說明 MobileReaderView.test.ts「recalls the hint from the toolbar after it has been seen」;e2e 在 reload(旗標已寫入、提示不再自動出現)之後按下按鈕,斷言提示重新可見,且其底緣不低於工具列頂緣
首次自動顯示行為不變 單元測試同時涵蓋「首開顯示並寫入旗標」與「旗標存在時不自動顯示」;既有 e2e 對首開提示與 localStorage 旗標的斷言未修改
新按鈕不會把其他四顆擠到不可點 e2e 在 320px 寬視窗下斷言工具列有 5 顆按鈕、每顆 boundingBox 寬高皆 ≥ 44px;reader-fonts.spec.ts 同樣在 320px 下驗證五顆仍排在同一列

另外把提示重複按下時「重設而非疊加 timer」也寫成測試,避免兩顆 timer 讓提示提早消失。

檢查

已執行(Node 23.6.0,因為 docs/development/setup.md 記載 Node 26 會讓前端套件整批在 import 階段失敗):

  • npm --prefix frontend test — 127 files / 1266 tests passed
  • npm --prefix frontend run build
  • npm --prefix frontend run check-boundaries
  • npm --prefix frontend run check-licenses
  • npx playwright test mobile-reader.spec.tsreader-fonts.spec.ts — 皆 passed

未執行:三個 Go module 的 go testgolangci-lint。本 diff 沒有任何 Go 變更(只動 frontend/e2e/docs/CHANGELOG.md),留給 CI 覆蓋。

順帶修改

reader-fonts.spec.ts 原本硬寫「工具列有 4 顆按鈕」,本次刻意新增第五顆,故同步改為 5——這是有意的契約更新,不是為了讓測試變綠。

Ticket: https://app.notion.com/p/3cb190bf023b81d3ac34de16826e482f

The gesture hint showed once per device and was then unreachable: the
first-open path wrote reader-mobile-gesture-hint-seen before showing it,
and nothing else could bring it back. Add a "?" button to the reader
toolbar that replays the same hint on the same 4s timer, lifting it
above the chrome so it does not land under the button that recalled it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CE5UjUaYrwpXViv5Pj2G17
@mudream4869
mudream4869 merged commit 69354d4 into dev Aug 29, 2026
5 checks passed
@mudream4869
mudream4869 deleted the mudream4869/reader-gesture-hint-recall branch August 29, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant