fix(runtime): 狭い viewport で footnote tooltip がはみ出る問題を修正#39
Merged
Conversation
モバイル等の狭い viewport で長い footnote の tooltip を開くと、tooltip 幅が viewport 幅を超えた際に右端clamp `left = innerWidth - tipWidth - margin` が 負値になり、tooltip が画面端からはみ出していた。max-width 制約も無かった。 修正 (positionTooltip / showTooltipEl の両方): - 測定前に tip.style.maxWidth = innerWidth - 2*margin を設定し、tooltip 幅を viewport 内に収める - 右端clamp の後に left の下限を margin にクランプし、over-wide な tooltip でも 左端からはみ出さないようにする test: packages/runtime/tests/footnote.test.ts を新規追加。happy-dom で getBoundingClientRect / innerWidth を stub し、max-width 設定と左端clamp の 両方を検証 (左端clamp 無しでは left=-6 になり失敗する回帰テスト)。
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wdpr-demo-v1 | d7ee35e | Commit Preview URL Branch Preview URL |
Jun 03 2026, 03:45 AM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wdpr-demo-v1-files | d7ee35e | Commit Preview URL Branch Preview URL |
Jun 03 2026, 03:44 AM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
decompiler-preview | d7ee35e | Commit Preview URL Branch Preview URL |
Jun 03 2026, 03:44 AM |
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.
Summary
maxWidthを viewport - margin*2 で制約し、leftを viewport 左端 - margin で下限 clamp。Changes
packages/runtime/src/utils/tooltip.ts(およびfootnote.ts経由):tip.style.maxWidth = ${Math.max(0, win.innerWidth - margin*2)}pxで制限。if (left < win.scrollX + margin) left = win.scrollX + margin。stubRect、setViewportWidth、globalThis.Nodeセットアップ)。Test plan