fix-15699

This commit is contained in:
wangxing 2019-03-28 17:04:26 +08:00
parent a83b7dc516
commit 44ad6b0c07

View File

@ -171,10 +171,12 @@ class Menu extends React.Component<MenuProps, MenuState> {
// when inlineCollapsed menu width animation finished
// https://github.com/ant-design/ant-design/issues/12864
const widthCollapsed = e.propertyName === 'width' && e.target === e.currentTarget;
// Fix e.target.className.indexOf is not a function
// https://github.com/ant-design/ant-design/issues/15699
const { className = '' } = e.target as HTMLElement;
// Fix for <Menu style={{ width: '100%' }} />, the width transition won't trigger when menu is collapsed
// https://github.com/ant-design/ant-design-pro/issues/2783
const iconScaled =
e.propertyName === 'font-size' && (e.target as HTMLElement).className.indexOf('anticon') >= 0;
const iconScaled = e.propertyName === 'font-size' && className.indexOf('anticon') >= 0;
if (widthCollapsed || iconScaled) {
this.restoreModeVerticalFromInline();
}