Skip to content

Commit 8b953aa

Browse files
committed
fix: Fixed DropDownMenu onChangeValue callback error
1 parent bac2e5b commit 8b953aa

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/DropDownMenu/index.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,8 @@ export class DropDownMenu extends React.Component<DropDownMenuProps, DropDownMen
130130
this.addBlurEvent.cleanEvent();
131131
}
132132

133-
toggleShowList = (e: React.SyntheticEvent<HTMLDivElement>) => {
133+
toggleShowList = (currentValue: string) => {
134134
const { currentValues, showList } = this.state;
135-
const valueNode = e.currentTarget.children[0] as any;
136-
const currentValue = valueNode.innerText;
137135
if (showList) {
138136
currentValues.unshift(...currentValues.splice(currentValues.indexOf(currentValue), 1));
139137
}
@@ -205,7 +203,7 @@ export class DropDownMenu extends React.Component<DropDownMenuProps, DropDownMen
205203
height: (isCurrent || showList) ? itemHeight : 0,
206204
background: (isCurrent && showList) ? theme.listAccentLow : "none"
207205
}}
208-
onClick={this.toggleShowList}
206+
onClick={() => this.toggleShowList(value)}
209207
onMouseEnter={!showList ? itemAttributes.onMouseEnter : (e) => {
210208
e.currentTarget.style.background = isCurrent ? theme.listAccentMedium : theme.useFluentDesign ? theme.listLow : theme.chromeMedium;
211209
itemAttributes.onMouseEnter(e);

0 commit comments

Comments
 (0)