Skip to content

Blazor: Conditionally rendered attributes are ignored. #10122

@rxelizondo

Description

@rxelizondo

On a Blazor page, given the following markup:

<button @(SomeObject == null ? "abc" : "xyz")>Click me</button>

If "SomeObject" is null then the button tag should include the "abc" attribute in it, if "SomeObject" is not null, the button tag should include the "xyz" attribute in it.

What really happens is that no attributes are rendered regardless of the "SomeObject" value.

Having this work correctly is particularly important when rendering "disabled" or "selected" attributes since those are standalone attributes.

Metadata

Metadata

Assignees

Labels

area-blazorIncludes: Blazor, Razor ComponentsbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions