fix(segment): ensure checked classes get set after not having a value (#21547)

This commit is contained in:
Liam DeBeasi
2020-06-16 11:22:17 -04:00
committed by GitHub
parent d8b377ffeb
commit 17308f247f

View File

@ -213,6 +213,7 @@ export class Segment implements ComponentInterface {
// If there are no checked buttons, set the current button to checked // If there are no checked buttons, set the current button to checked
if (!checked) { if (!checked) {
this.value = clicked.value; this.value = clicked.value;
this.setCheckedClasses();
} }
// If the gesture began on the clicked button with the indicator // If the gesture began on the clicked button with the indicator
@ -375,8 +376,12 @@ export class Segment implements ComponentInterface {
const previous = this.checked; const previous = this.checked;
this.value = current.value; this.value = current.value;
if (previous && this.scrollable) { if (this.scrollable) {
if (previous) {
this.checkButton(previous, current); this.checkButton(previous, current);
} else {
this.setCheckedClasses();
}
} }
this.checked = current; this.checked = current;