Graph root is not a containing block for absolutely positioned layers
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #425 @draedful による — マージ済み
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- playwright, react, typescript
調査の方向性
Start with packages/graph/src/services/Layer.css, Graph.attach(root), and packages/graph-react/src/graph-canvas.css to trace how the root and layers are positioned. Then inspect the contract apps and the linked pull request #425; the acceptance criteria call for a vanilla graph E2E test with a padded, bordered root, unchanged React behavior, and an intentional decision about the contract workarounds and migration docs.
索引モデルが issue の本文から書いたものです。
説明
Problem
Core layers are absolutely positioned (packages/graph/src/services/Layer.css: .layer { position: absolute; inset: 0; width: 100%; height: 100% }), but neither Graph.attach(root) nor the core stylesheet makes the root a containing block, and the docs do not say the root must be positioned. Only the React wrapper does it (packages/graph-react/src/graph-canvas.css: position: relative).
In a vanilla app whose root is not positioned, the layers are laid out against the nearest positioned ancestor or the viewport, not against the root:
- the canvas covers the page (observed
0,0 1280×720for a root at24,24 902×652); - pointer hit-testing uses canvas-relative coordinates (
Graph.getPointInCameraSpace→getXY(canvas, event)), while the camera's wheel zoom (Camera.ts) and code that maps world points to the root (cameraService.getAbsoluteXY+ root rect, used by@gravity-ui/graph-playwright) use the root's box. Clicks land ~25px off. Large blocks absorb the error; thin connections are missed.
The package-contract apps work around it with style="position: relative" on #graph (packages/graph-devtools/contract/app/index.html, packages/graph-playwright/contract/app/index.html); the shared scripts/package-contract/shared/base.css does not set it.
Proposal
Pick one and document it:
- Core makes the root a containing block, e.g. a
.graph-root { position: relative }class added byattach()(and removed on detach), or an inline style only when the computedpositionisstatic. Consumers' own positioning keeps working. - Or document the requirement in the core README / getting-started docs and warn in development when the attached root has
position: static.
Option 1 is preferred: it matches what GraphCanvas already does and removes a silent misalignment.
Acceptance criteria
- A vanilla graph attached to a non-positioned root renders inside the root and hit-tests correctly (E2E: root with padding/border, click a connection via
GraphConnectionPO.click()). - React
GraphCanvasbehaviour is unchanged. - The
position: relativeworkarounds in contract apps are removed or kept intentionally; docs and the v1→v2 migration guide mention the change if behaviour changes.
Found while adding the graph-playwright package contract in #406.
🤖 Drafted with Claude Code
- 主要言語
- TypeScript
- スター
- 145
- フォーク
- 12
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 43
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
gravity-ui/graph のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
gravity-ui/graph#457 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
gravity-ui/graph#455 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
gravity-ui/graph#456 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
gravity-ui/graph#431 ·
メンテナーはふだん 1 日以内に返信
-
proposal
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
gravity-ui/graph#416 ·
メンテナーはふだん 1 日以内に返信
gravity-ui/graph の issue をすべて見る
似ている issue
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
openclaw/openclaw#199885 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
feature needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
BoardGamesEmpire/board-games-empire-backend#1306 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
sequant-io/sequant#1689 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100