bug(cdk/portal): DOM node inserted at the wrong place

未關閉
#34,025 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
57/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
angular, typescript
領域
frontend

研究方向

Start with the linked reproduction commit and trace how cdkPortalOutlet inserts portal content relative to its outlet in Angular CDK. Reproduce the reported behavior, then locate or add a focused test for portal placement. Done means the SVG appears where the outlet is declared, with the test confirming the placement.

由索引模型根據 Issue 內容生成。

描述

area: cdk/portal gemini-triaged needs triage
Is this a regression?
  • Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was

No response

Description

Instead of being inserted at the location of the portal outlet, the DOM node in the portal is inserted at the end of the component's template.

Reproduction

StackBlitz doesn't work in my browser.

https://codeberg.org/Gouvernathor/ParliamentDiagram-Angular/commit/95ada2ff983f4e22109b50392cfa9e2706aa7f6c

Expected Behavior

The SVG diagram should be inserted at the place where I wrote the ng-template carrying the cdkPortalOutlet directive, which is at the beginning of the component.

Actual Behavior

The SVG diagram is inserted at the end of the component.

Environment

Angular CLI : 22.1.3
Angular : 22.1.1
Node.js : 26.4.0
Package Manager : npm 11.12.0
Operating System : win32 x64

┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 22.1.3 │ ^22.1.3 │
│ @angular/cdk │ 22.1.1 │ ^22.1.1 │
│ @angular/cli │ 22.1.3 │ ^22.1.3 │
│ @angular/common │ 22.1.1 │ ^22.1.1 │
│ @angular/compiler │ 22.1.1 │ ^22.1.1 │
│ @angular/compiler-cli │ 22.1.1 │ ^22.1.1 │
│ @angular/core │ 22.1.1 │ ^22.1.1 │
│ @angular/forms │ 22.1.1 │ ^22.1.1 │
│ @angular/material │ 22.1.1 │ ^22.1.1 │
│ @angular/platform-browser │ 22.1.1 │ ^22.1.1 │
│ @angular/router │ 22.1.1 │ ^22.1.1 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 6.0.3 │ ~6.0.3 │
│ vitest │ 4.1.10 │ ^4.0.8 │
└───────────────────────────┴───────────────────┴───────────────────┘

主要語言
TypeScript
星號
25k
分支
6.8k
平均合併
3 天 3 小時
30 天內合併 PR
56

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

angular/components 的其他 Issue

查看 angular/components 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。