fix(Picker): move to next option when default option is disabled (#7499)
* fix(Picker): should move to next option when defaultOption is disabled * test: update spec name
This commit is contained in:
+10
-2
@@ -86,7 +86,15 @@ export default createComponent({
|
||||
let cursor = { children: this.columns };
|
||||
|
||||
while (cursor && cursor.children) {
|
||||
const defaultIndex = cursor.defaultIndex ?? +this.defaultIndex;
|
||||
const { children } = cursor;
|
||||
let defaultIndex = cursor.defaultIndex ?? +this.defaultIndex;
|
||||
|
||||
while (
|
||||
children[defaultIndex].disabled &&
|
||||
defaultIndex < children.length - 1
|
||||
) {
|
||||
defaultIndex++;
|
||||
}
|
||||
|
||||
formatted.push({
|
||||
values: cursor.children,
|
||||
@@ -94,7 +102,7 @@ export default createComponent({
|
||||
defaultIndex,
|
||||
});
|
||||
|
||||
cursor = cursor.children[defaultIndex];
|
||||
cursor = children[defaultIndex];
|
||||
}
|
||||
|
||||
this.formattedColumns = formatted;
|
||||
|
||||
Reference in New Issue
Block a user