From 17308f247f8750029ece39548c9f457e15326189 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Tue, 16 Jun 2020 11:22:17 -0400 Subject: [PATCH] fix(segment): ensure checked classes get set after not having a value (#21547) --- core/src/components/segment/segment.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/src/components/segment/segment.tsx b/core/src/components/segment/segment.tsx index 72464ad9d8..54ffb88047 100644 --- a/core/src/components/segment/segment.tsx +++ b/core/src/components/segment/segment.tsx @@ -213,6 +213,7 @@ export class Segment implements ComponentInterface { // If there are no checked buttons, set the current button to checked if (!checked) { this.value = clicked.value; + this.setCheckedClasses(); } // If the gesture began on the clicked button with the indicator @@ -375,8 +376,12 @@ export class Segment implements ComponentInterface { const previous = this.checked; this.value = current.value; - if (previous && this.scrollable) { - this.checkButton(previous, current); + if (this.scrollable) { + if (previous) { + this.checkButton(previous, current); + } else { + this.setCheckedClasses(); + } } this.checked = current;