mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
check SVGAnimatedString
This commit is contained in:
parent
44ad6b0c07
commit
1f60f37907
@ -171,12 +171,19 @@ class Menu extends React.Component<MenuProps, MenuState> {
|
|||||||
// when inlineCollapsed menu width animation finished
|
// when inlineCollapsed menu width animation finished
|
||||||
// https://github.com/ant-design/ant-design/issues/12864
|
// https://github.com/ant-design/ant-design/issues/12864
|
||||||
const widthCollapsed = e.propertyName === 'width' && e.target === e.currentTarget;
|
const widthCollapsed = e.propertyName === 'width' && e.target === e.currentTarget;
|
||||||
// Fix e.target.className.indexOf is not a function
|
|
||||||
|
// Fix SVGElement e.target.className.indexOf is not a function
|
||||||
// https://github.com/ant-design/ant-design/issues/15699
|
// https://github.com/ant-design/ant-design/issues/15699
|
||||||
const { className = '' } = e.target as HTMLElement;
|
const { className } = e.target as (HTMLElement | SVGElement);
|
||||||
|
// SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during an animation.
|
||||||
|
const classNameValue =
|
||||||
|
Object.prototype.toString.call(className) === '[object SVGAnimatedString]'
|
||||||
|
? className.animVal
|
||||||
|
: className;
|
||||||
|
|
||||||
// Fix for <Menu style={{ width: '100%' }} />, the width transition won't trigger when menu is collapsed
|
// 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
|
// https://github.com/ant-design/ant-design-pro/issues/2783
|
||||||
const iconScaled = e.propertyName === 'font-size' && className.indexOf('anticon') >= 0;
|
const iconScaled = e.propertyName === 'font-size' && classNameValue.indexOf('anticon') >= 0;
|
||||||
if (widthCollapsed || iconScaled) {
|
if (widthCollapsed || iconScaled) {
|
||||||
this.restoreModeVerticalFromInline();
|
this.restoreModeVerticalFromInline();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user