diff --git a/core/src/components/segment/segment.tsx b/core/src/components/segment/segment.tsx
index 4b7913d76b8..4c425e18b2e 100644
--- a/core/src/components/segment/segment.tsx
+++ b/core/src/components/segment/segment.tsx
@@ -141,14 +141,6 @@ export class Segment implements ComponentInterface {
async componentDidLoad() {
this.setCheckedClasses();
- /**
- * If the value changes before watchers
- * are setup, then the ionSelect watch callback
- * will not fire. As a result, we manually
- * fire this event when Select is loaded.
- */
- this.ionSelect.emit({ value: this.value });
-
/**
* We need to wait for the buttons to all be rendered
* before we can scroll.
@@ -495,6 +487,15 @@ export class Segment implements ComponentInterface {
}
};
+ private onSlottedItemsChange = () => {
+ /**
+ * When the slotted segment buttons change we need to
+ * ensure that the new segment buttons are checked if
+ * the value matches the segment button value.
+ */
+ this.valueChanged(this.value);
+ };
+
private getSegmentButton = (selector: 'first' | 'last' | 'next' | 'previous'): HTMLIonSegmentButtonElement | null => {
const buttons = this.getButtons().filter((button) => !button.disabled);
const currIndex = buttons.findIndex((button) => button === document.activeElement);
@@ -573,7 +574,7 @@ export class Segment implements ComponentInterface {
'segment-scrollable': this.scrollable,
})}
>
-
+
);
}