-
-
Notifications
You must be signed in to change notification settings - Fork 362
fix(Affix): use culture-invariant for position #6796
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,8 @@ | |
| // See the LICENSE file in the project root for more information. | ||
| // Maintainer: Argo Zhang([email protected]) Website: https://www.blazor.zone | ||
|
|
||
| using System.Globalization; | ||
|
|
||
| namespace BootstrapBlazor.Components; | ||
|
|
||
| /// <summary> | ||
|
|
@@ -40,8 +42,8 @@ public partial class Affix | |
| .Build(); | ||
|
|
||
| private string? StyleString => CssBuilder.Default("position: sticky;") | ||
| .AddStyle("z-index", $"{ZIndex}", ZIndex.HasValue) | ||
| .AddStyle(Position.ToDescriptionString(), $"{Offset}px") | ||
| .AddClass($"z-index: {ZIndex};", ZIndex.HasValue) | ||
| .AddClass($"{Position.ToDescriptionString()}: {Offset.ToString(CultureInfo.InvariantCulture)}px;") | ||
|
Comment on lines
+45
to
+46
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Switching from AddStyle to AddClass for inline styles may cause rendering issues. AddClass is intended for CSS class names, not inline style properties. Using it for styles like z-index and offsets may result in incorrect rendering unless CssBuilder explicitly supports this pattern. Revert to AddStyle unless you have verified compatibility. |
||
| .AddStyleFromAttributes(AdditionalAttributes) | ||
| .Build(); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method calls should be
AddStyleinstead ofAddClass. CSS styles should be added using the style methods, not class methods. This will likely result in incorrect CSS output.