Skip to content

fix: サイドバー同期トーストの見切れを body ポータルで修正 (#1399)#1401

Merged
Kewton merged 1 commit into
developfrom
feature/1399-worktree
Jul 18, 2026
Merged

fix: サイドバー同期トーストの見切れを body ポータルで修正 (#1399)#1401
Kewton merged 1 commit into
developfrom
feature/1399-worktree

Conversation

@Kewton

@Kewton Kewton commented Jul 18, 2026

Copy link
Copy Markdown
Owner

概要

サイドバーの同期(Sync)ボタン押下時に表示されるトーストが、ビューポート右下ではなくサイドバー基準に配置され左端が見切れる不具合を修正する。Closes #1399

根本原因

ToastContainersrc/components/common/Toast.tsx)は position: fixed だが、showToast を呼ぶ SyncButton 内で描画され、その祖先 <aside data-testid="sidebar-container">AppShell.tsx)が transform(スライド演出)を持つ。CSS 仕様上、transform を持つ祖先は position: fixed 子孫の containing block になるため、トーストがビューポートではなくサイドバー枠(既定幅 224px)を基準に配置され、min-w-[300px] のトーストの左端が画面外へはみ出して見切れていた。

変更内容

  • ToastContainercreatePortal(..., document.body) で描画するよう変更(Toast.tsx のみ、+19/-1)
  • SSR/hydration 対策として mounted ガードを追加し、クライアントマウント後のみ portal 描画(既存の Modal.tsx / CommandPalette.tsx と同パターン)
  • これにより呼び出し元のツリー位置に関わらず fixed がビューポート基準となり、トーストが右下に全幅で表示される

テスト

  • npm run lint : PASS
  • npx tsc --noEmit : PASS
  • npm run test:unit(CI=true): PASS(596 files / 10167 tests)

影響範囲

ToastContainer が transform を持つ祖先 <aside data-testid="sidebar-container">
(AppShell) の subtree 内で描画されるため、position:fixed の containing block が
サイドバー枠となり、右下のはずのトーストがサイドバー基準に配置され左端が見切れて
いた。ToastContainer を createPortal(..., document.body) でラップして containing
block を viewport に戻す。SSR/hydration 対策として client-mount 後のみ portal を
描画する(CommandPalette / Modal と同じパターン)。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QRiYX98sodhZtCyHtbswoR
@Kewton Kewton added the bug Something isn't working label Jul 18, 2026
@Kewton
Kewton merged commit ea21f15 into develop Jul 18, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant