Skip to content

Fix. Quickgrid PropertyColumn Align property doesn't work with Align.Right #62707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

dariatiurina
Copy link
Contributor

@dariatiurina dariatiurina commented Jul 14, 2025

Fix. Quickgrid PropertyColumn Align property doesn't work with Align.Right

Description

This pull request refactors and fixes the column alignment and justification styles in the QuickGrid.razor.css file.

Changes:

  • Added new styles for .col-justify-start .col-options and td.col-justify-start to support left-aligned column options and text.
  • Introduced td.col-justify-right and td.col-justify-left styles for explicit right and left text alignment.

Reasoning for change:

In the aspnetcore\src\Components\QuickGrid\Microsoft.AspNetCore.Components.QuickGrid\src\QuickGrid.razor.cs Blazor assigns css classes based on the Align parameter that user has set. However, in the src\Components\QuickGrid\Microsoft.AspNetCore.Components.QuickGrid\src\QuickGrid.razor.css there were no implementation for 3 out of existing 5 parameter options. This PR fixes implements missing options.

Fixes #50029

@dariatiurina dariatiurina self-assigned this Jul 14, 2025
@Copilot Copilot AI review requested due to automatic review settings July 14, 2025 13:44
@dariatiurina dariatiurina requested a review from a team as a code owner July 14, 2025 13:44
@github-actions github-actions bot added the area-blazor Includes: Blazor, Razor Components label Jul 14, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes a bug where the QuickGrid PropertyColumn's Align property doesn't work correctly with right alignment (Align.Right). The fix refactors CSS styles to properly support column alignment and adds missing styles for consistent column options positioning.

  • Reorganizes existing CSS rules for better logical grouping
  • Adds support for col-justify-start styles for left alignment consistency
  • Introduces explicit col-justify-right and col-justify-left styles for direct alignment control
  • Adds RTL (right-to-left) support for the new col-justify-start styles

Comment on lines +92 to +98
td.col-justify-right {
text-align: right;
}

td.col-justify-left {
text-align: left;
}
Copy link
Preview

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The styles td.col-justify-right and td.col-justify-left appear to duplicate the functionality of existing td.col-justify-end and td.col-justify-start styles. This creates redundant CSS rules that could lead to maintenance issues. Consider using a single consistent naming convention.

Suggested change
td.col-justify-right {
text-align: right;
}
td.col-justify-left {
text-align: left;
}

Copilot uses AI. Check for mistakes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@oroztocil oroztocil Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought the additional classes were so that they can be overwritten in different scenarios (in particular when the page is set to Right-To-Left text direction). But maybe I misunderstood it, CSS is harder to mentally parse than lambda calculus 😄

Copy link
Member

@oroztocil oroztocil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it in a sample project and the Align.Right property is working now 👍

@@ -76,10 +71,32 @@ td.col-justify-center {
text-align: center;
}

.col-justify-end .col-options {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move it back to the original position. Moving it few lines does not change the functionality but might be confusing later to read the change history, e.g. when using git blame

Comment on lines +92 to +98
td.col-justify-right {
text-align: right;
}

td.col-justify-left {
text-align: left;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quickgrid PropertyColumn Align property doesn't work with Align.Right
3 participants