You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: segment does not set active button when dynamically changing options in angular #29414
I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v7.x
Current Behavior
When updating the nested segment buttons of the Segment control the active segment button looses it's checked state even when the value matches the value of the containing Segment control.
The issue is similar to #28816 but for segment-button, i.e. the value changes after connectedCallback is fired but before any Stencil Watchers are configured. As a result, the value property watcher does not fire which causes updateState not to be called.
The fix in #28837 only fixes the problem on initial rendering, but not on subsequent updates to the nested segment buttons.
Expected Behavior
The active segment button should be highlighted when it's value matches the value of it's containing segment control - as was the case before standalone components.
cordova-res : not installed
native-run (update available: 2.0.1) : 1.7.4
System:
NodeJS : v20.11.0
npm : 10.2.4
OS : macOS Unknown
Additional Information
In the Stackblitz reproduction example the nested segment buttons are updated with an additional button, but keeping same value for the first 2 buttons - the problem is the same though when rendering nested buttons each with a new value while updating the value of the Segment control at the same time to match one of the newly rendered buttons.
changed the title [-]bug: Active segment button not highlighted when updating nested segment buttons in Segment standalone component[/-][+]bug: segment does not set active button when dynamically changing options in angular[/+]on Apr 29, 2024
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Activity
[-]bug: Active segment button not highlighted when updating nested segment buttons in Segment standalone component[/-][+]bug: segment does not set active button when dynamically changing options in angular[/+]sean-perkins commentedon Apr 29, 2024
Thank you for this issue!
I was able to confirm this issue does not reproduce in the isolated web components, but occurs when consumed in Angular.
We might be able to use
onSlotchangehere inion-segmentto handle the "value change" (items changing) behavior.sean-perkins commentedon Apr 29, 2024
Here is a dev-build:
8.0.2-dev.11714411675.10f48160if you would like to test and report any unexpected behaviors.Thanks!
mariusbolik commentedon Apr 29, 2024
This Bug also appears on
ion-radio-groupand maybe on other components like accordion.Hier is the code to reproduce: https://stackblitz.com/edit/angular-vquurr-ec7ark?file=src%2Fapp%2Fexample.component.html
jakobe commentedon Apr 30, 2024
@sean-perkins Great! And thanks for the quick reply ⚡
I can confirm this fix works in my scenario as well 👌🏻
I've updated the Stackblitz reproduction example: https://stackblitz.com/edit/angular-elmzeu
fix(angular): set active segment button when dynamically changing ite…
ionitron-bot commentedon May 31, 2024
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.