Skip to content

Commit

Permalink
fix #458 RadioGroup ignores setValue in readOnly-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Dec 22, 2024
1 parent 390c6b2 commit aebac16
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public Radio(T value, String label) {
withValue(value);
EventListener listener =
evt -> {
if (isEnabled() && !isChecked()) {
if (isEnabled() && !isChecked() && !isReadOnly()) {
check();
}
};
Expand Down Expand Up @@ -273,7 +273,7 @@ private Radio<T> setChecked(boolean value, boolean silent) {
return this;
}
if (nonNull(radioGroup)) {
if (!(radioGroup.isReadOnly() || radioGroup.isDisabled())) {
if (!radioGroup.isDisabled()) {
T oldValue = (T) radioGroup.getValue();
radioGroup.getRadios().stream()
.filter(Radio::isChecked)
Expand Down Expand Up @@ -758,4 +758,9 @@ public T withRadioGroup(ChildHandler<Radio<T>, RadioGroup<? super T>> handler) {
handler.apply(this, radioGroup);
return (T) this;
}

@Override
public boolean isReadOnly() {
return super.isReadOnly() || radioGroup.isReadOnly();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,15 @@ textarea.dui-field-input {
--dui-accent-d-2: var(--dui-form-field-disabled-color-darker);
pointer-events: none;
}

.dui-form-radio[disabled] .dui-radio-label{
color: var(--dui-form-field-disabled-color);
}

.dui-form-radio-group[readonly] .dui-form-radio,
.dui-form-radio[readonly] {
pointer-events: none;
}

.dui-form-radio {
position: relative;
Expand Down

0 comments on commit aebac16

Please sign in to comment.