Custom property style bindings ignore static and `[style]` values of same name since 22.1
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- angular, typescript
- 领域
- frontend
调研方向
Start with the compiler package and the compliance golden at style_bindings/css_custom_properties.js, which shows the differing keys for custom properties. Trace how style priority looks up values when [style.--x] is combined with static style or [style], then add regression coverage for the reported cases. Done when the bound custom property preserves the static or [style] value when its binding is undefined and the regression tests pass.
由索引模型根据 Issue 内容生成。
描述
Which @angular/* package(s) are the source of the bug?
compiler
Is this a regression?
Yes, works in 22.0.8, broken in 22.2.4 and 22.3.0-next.3. Came with #68846
Description
Hit this in my ui lib, had to move component inputs to separate variable
[style.--x] compiles to key --%NS%x, but static style="--x: red" and [style]="'--x: red'" keep --x. Styling priority looks values up by key, so these never mathc and binding stops seeing value of same name. [style.color] is not affected. No provideCssVarNamespacing() needed to hit this
- host binding
[style.--x]now overwrites value author set on component element, before author won undefinedno longer falls back to static or[style]value, element ends up without--x
| case | bound value | 22.0.8 | 22.2.4 | same case with color, 22.2.4 |
|---|---|---|---|---|
<my-cmp style="--x: red"> + host [style.--x] |
blue |
--x: red |
--x: blue |
color: red |
<my-cmp style="--x: red"> + host [style.--x] |
undefined |
--x: red |
empty | color: red |
<i style="--x: red" [style.--x]="v"> |
undefined |
--x: red |
empty | color: red |
<i [style]="'--x: red'" [style.--x]="v"> |
undefined |
--x: red |
empty | color: red |
host style: '--x: red' + host [style.--x] |
undefined |
--x: red |
empty | color: red |
With provideCssVarNamespacing('ns') both stay on element: --x: red; --ns_x: blue
Please provide a link to a minimal reproduction of the bug
@Component({ selector: 'my-cmp', template: '', host: { '[style.--x]': 'v' } })
class MyCmp {
@Input() v?: string;
}
@Component({ selector: 'app-root', imports: [MyCmp], template: `<my-cmp style="--x: red" v="blue" />` })
class App {}
getAttribute('style') on my-cmp: --x: red in 22.0.8, --x: blue in 22.2.4 and 22.3.0-next.3
Please provide the exception or error you saw
None
Please provide the environment you discovered this bug in (run ng version)
@angular/core 22.0.8, 22.2.4 and 22.3.0-next.3, Chromium, JIT
Anything else?
Compliance golden style_bindings/css_custom_properties.js shows same split: --camel-case in consts, --%NS%camelCase in ɵɵstyleProp
- 主要语言
- TypeScript
- 星标
- 101k
- 派生
- 28.2k
- 平均合并
- 2 天 45 分钟
- 30 天内合并 PR
- 373
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
angular/angular 的其他 Issue
-
Two-way binding documentation is missing important information可能重新可做 关联的 PR 已关闭且未合并。 未关闭area: docs
难度 2/5 1-3 小时 新手友好度 75/100
angular/angular#71796 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
area: core
难度 2/5 1-3 小时 新手友好度 78/100
angular/angular#71585 · 3 条评论 ·
维护者通常 1 天内回复
-
Assigning to a template reference in an event binding isn't reported by the compiler可能重新可做 关联的 PR 已关闭且未合并。 未关闭area: compiler
难度 2/5 1-3 小时 新手友好度 74/100
angular/angular#71511 · 3 条评论 ·
维护者通常 1 天内回复
-
Signal Forms: `validateStandardSchema` throws a TypeError for an issue whose path runs through a key the model lacks可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area: forms gemini-triaged
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
`Symbol.iterator in FieldTree` is always false可能重新可做 关联的 PR 已关闭且未合并。 未关闭area: forms forms: signals
难度 2/5 1-3 小时 新手友好度 78/100
angular/angular#70252 · 3 条评论 ·
维护者通常 1 天内回复
相似的 Issue
-
truapi-release
难度 2/5 1-3 小时 新手友好度 72/100
paritytech/product-sdk#529 ·
维护者通常 1 天内回复
-
Environments table lists page size 5 after 30可能已有人在做 @raus7n 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 90/100
litmuschaos/litmus#5743 ·
维护者通常 2 天内回复
-
desktop grp:admin-donors type:graphics-bug ui-admin
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
milind-soni/OpenMausBot#6730 ·
维护者通常 1 天内回复
-
Status: Triage Type: Bug / Error
难度 2/5 1-3 小时 新手友好度 69/100
mermaid-js/mermaid-v13#1059 ·
维护者通常 1 天内回复