When the model is changed, some times the selectedIndex is no longer valid (too large) and must be changed.
However, the Sections does not know how the model was changed. Perhaps the model changed from ["one", "two", "three", "four"] to ["one", "two", "three"], with selectedIndex = 1 ("two"). It makes sense then that after changing the model, "two" is still selected. Since the app will know how/why the model changed, I think it is best for the app to set the new selectedIndex when the model changes. To prevent a selectedIndex >= model.length, we can reset selectedIndex to, for example, 0 or -1 when the model changes. However, when setting the value to >=0, that will trigger the action (if any) associated with that index, which may be unwanted. The only way to prevent this is to always reset the selectedIndex to -1. In that case, no action is triggered, and the app may set sectionIndex to any desired value (which, in turn, will trigger an associated Action if there is one). I attached an MR that does what I describe above. And it does this *only* if the model is changed after the Sections component was completed to prevent overriding a selectedIndex that was set by the app developer (which would cause a regression of this fix https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1511839 ). -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1513933 Title: Page.head.sections.selectedIndex does not reset when changing model To manage notifications about this bug go to: https://bugs.launchpad.net/canonical-devices-system-image/+bug/1513933/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs