[PR #2063] Fix default button text regression in DialogService #3058

Closed
opened 2026-01-29 18:21:43 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/radzenhq/radzen-blazor/pull/2063

State: closed
Merged: Yes


Fix default button text regression in DialogService

This PR addresses a regression introduced in #2051, where the default values for OkButtonText and CancelButtonText in ConfirmOptions and AlertOptions were not being set when omitted.

A fix for the regression was introduced in 92d69d9.
However, while validating that fix in the unit tests, I found that when a DialogOptions object is supplied with null values for the button text, those values were not replaced by the default.

Changes

  • DialogService.cs: Ensures OkButtonText and CancelButtonText are initialized with default values "Ok" and "Cancel" when not explicitly provided.
  • DialogServiceTests.cs: Added unit tests to assert default and custom values of OkButtonText and CancelButtonText in both ConfirmOptions and AlertOptions.

This PR ensures that null values still result in a fallback to "Ok" and "Cancel", to guarantee that buttons always have a visible label.

**Original Pull Request:** https://github.com/radzenhq/radzen-blazor/pull/2063 **State:** closed **Merged:** Yes --- ### Fix default button text regression in `DialogService` This PR addresses a regression introduced in [#2051](https://github.com/radzenhq/radzen-blazor/pull/2051), where the default values for `OkButtonText` and `CancelButtonText` in `ConfirmOptions` and `AlertOptions` were not being set when omitted. A fix for the regression was introduced in [92d69d9](https://github.com/radzenhq/radzen-blazor/commit/92d69d90536d0753024c411e71ba8b6717c4be6b). However, while validating that fix in the unit tests, I found that when a `DialogOptions` object is supplied with `null` values for the button text, those values were not replaced by the default. ### Changes - **DialogService.cs**: Ensures `OkButtonText` and `CancelButtonText` are initialized with default values `"Ok"` and `"Cancel"` when not explicitly provided. - **DialogServiceTests.cs**: Added unit tests to assert default and custom values of `OkButtonText` and `CancelButtonText` in both `ConfirmOptions` and `AlertOptions`. This PR ensures that `null` values still result in a fallback to `"Ok"` and `"Cancel"`, to guarantee that buttons always have a visible label.
claunia added the pull-request label 2026-01-29 18:21:43 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#3058