Skip to content

Commit 44c635d

Browse files
committed
fix(checkbox, toggle, radio-group): add initial value
1 parent cde3f14 commit 44c635d

File tree

6 files changed

+13
-4
lines changed

6 files changed

+13
-4
lines changed

core/src/components/checkbox/checkbox.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ export class Checkbox implements ComponentInterface {
174174
* a higher priority.
175175
*/
176176
Promise.resolve().then(() => {
177+
console.log('updating hint text id');
177178
this.hintTextID = this.getHintTextID();
178179
});
179180
}
@@ -193,6 +194,8 @@ export class Checkbox implements ComponentInterface {
193194
this.inheritedAttributes = {
194195
...inheritAriaAttributes(this.el),
195196
};
197+
198+
this.hintTextID = this.getHintTextID();
196199
}
197200

198201
disconnectedCallback() {

core/src/components/checkbox/test/validation/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ <h2>Optional Field (No Validation)</h2>
146146

147147
const isInvalid = checkbox.classList.contains('ion-invalid');
148148
if (isInvalid) {
149-
console.log('Field marked invalid:', checkbox.label, checkbox.errorText);
149+
console.log('Field marked invalid:', checkbox.innerText, checkbox.errorText);
150150
}
151151
});
152152

core/src/components/radio-group/radio-group.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ComponentInterface, EventEmitter } from '@stencil/core';
22
import { Build, Component, Element, Event, Host, Listen, Method, Prop, State, Watch, h } from '@stencil/core';
33
import { checkInvalidState } from '@utils/forms';
4-
import { renderHiddenInput } from '@utils/helpers';
4+
import { inheritAriaAttributes, renderHiddenInput } from '@utils/helpers';
55

66
import { getIonMode } from '../../global/ionic-global';
77

@@ -171,6 +171,10 @@ export class RadioGroup implements ComponentInterface {
171171
this.isInvalid = checkInvalidState(this.el);
172172
}
173173

174+
componentWillLoad() {
175+
this.hintTextID = this.getHintTextID();
176+
}
177+
174178
disconnectedCallback() {
175179
// Clean up validation observer to prevent memory leaks.
176180
if (this.validationObserver) {

core/src/components/radio-group/test/validation/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ <h2>Optional Field (No Validation)</h2>
157157

158158
const isInvalid = radioGroup.classList.contains('ion-invalid');
159159
if (isInvalid) {
160-
console.log('Field marked invalid:', radioGroup.label, radioGroup.errorText);
160+
console.log('Field marked invalid:', radioGroup.id, radioGroup.errorText);
161161
}
162162
});
163163

core/src/components/toggle/test/validation/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ <h2>Optional Field (No Validation)</h2>
146146

147147
const isInvalid = toggle.classList.contains('ion-invalid');
148148
if (isInvalid) {
149-
console.log('Field marked invalid:', toggle.label, toggle.errorText);
149+
console.log('Field marked invalid:', toggle.innerText, toggle.errorText);
150150
}
151151
});
152152

core/src/components/toggle/toggle.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,8 @@ export class Toggle implements ComponentInterface {
269269
this.inheritedAttributes = {
270270
...inheritAriaAttributes(this.el),
271271
};
272+
273+
this.hintTextID = this.getHintTextID();
272274
}
273275

274276
private onStart() {

0 commit comments

Comments
 (0)