@@ -107,7 +107,6 @@ export default {
107
107
const menuProps = {
108
108
props : {
109
109
multiple,
110
- defaultActiveFirst : defaultActiveFirstOption ,
111
110
itemIcon : multiple ? menuItemSelectedIcon : null ,
112
111
selectedKeys,
113
112
prefixCls : `${ prefixCls } -menu` ,
@@ -131,11 +130,15 @@ export default {
131
130
const activeKeyProps = { } ;
132
131
133
132
let clonedMenuItems = menuItems ;
133
+ let defaultActiveFirst = defaultActiveFirstOption ;
134
134
if ( selectedKeys . length || firstActiveValue ) {
135
135
if ( props . visible && ! this . lastVisible ) {
136
- activeKeyProps . activeKey =
137
- selectedKeys [ 0 ] !== undefined ? selectedKeys [ 0 ] : firstActiveValue ;
136
+ activeKeyProps . activeKey = selectedKeys [ 0 ] || firstActiveValue ; ;
138
137
} else if ( ! visible ) {
138
+ // Do not trigger auto active since we already have selectedKeys
139
+ if ( selectedKeys [ 0 ] ) {
140
+ defaultActiveFirst = false ;
141
+ }
139
142
activeKeyProps . activeKey = undefined ;
140
143
}
141
144
let foundFirst = false ;
@@ -180,7 +183,7 @@ export default {
180
183
if ( inputValue !== this . lastInputValue && ( ! lastValue || lastValue !== backfillValue ) ) {
181
184
activeKeyProps . activeKey = '' ;
182
185
}
183
- menuProps . props = { ...activeKeyProps , ...menuProps . props } ;
186
+ menuProps . props = { ...activeKeyProps , ...menuProps . props , ... { defaultActiveFirst } } ;
184
187
return < Menu { ...menuProps } > { clonedMenuItems } </ Menu > ;
185
188
}
186
189
return null ;
0 commit comments