Skip to content

Fix draggable Attribute Rendering for Blazor Elements#67970

Open
BrundhaVelusamy wants to merge 3 commits into
dotnet:mainfrom
BrundhaVelusamy:DraggableAttribute
Open

Fix draggable Attribute Rendering for Blazor Elements#67970
BrundhaVelusamy wants to merge 3 commits into
dotnet:mainfrom
BrundhaVelusamy:DraggableAttribute

Conversation

@BrundhaVelusamy

Copy link
Copy Markdown

Description

This change fixes rendering of the HTML draggable attribute in Blazor.

Previously, when a bool value was supplied to an element attribute such as:

<div draggable="@isDraggable">

Blazor treated draggable as a standard HTML boolean attribute. As a result, it rendered a bare draggable attribute when the value was true and omitted the attribute entirely when the value was false. Since draggable is an enumerated attribute rather than a boolean attribute, this produced invalid HTML and could lead to inconsistent drag-and-drop behavior in browsers.

This update changes the rendering behavior so that:

  • element attributes named draggable (case-insensitive) are treated specially
  • true is rendered as draggable="true"
  • false is rendered as draggable="false"
  • the change applies only to element attributes and does not affect component parameters
  • component parameters continue to receive boxed bool values, preserving existing [Parameter] bool behavior
  • existing SSR, render batch serialization, and interactive rendering paths continue to work without modification since they already support string-valued attribute frames

This ensures that Blazor emits spec-compliant HTML for the draggable attribute and provides consistent drag-and-drop behavior across browsers.

Output

Before:

DraggableAttr_Issue.mp4

After:

DraggableAttr_Fix.mp4

Fixes #60137

@BrundhaVelusamy
BrundhaVelusamy requested a review from a team as a code owner July 23, 2026 07:31
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Jul 23, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @BrundhaVelusamy. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pass boolean value to draggable attribute

1 participant