Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The sidebar shrinks and the menu still displays #8587

Closed
zhayes opened this issue Dec 13, 2017 · 13 comments
Closed

The sidebar shrinks and the menu still displays #8587

zhayes opened this issue Dec 13, 2017 · 13 comments

Comments

@zhayes
Copy link

@zhayes zhayes commented Dec 13, 2017

Version

3.0.1

Environment

antd @3.0.1

Reproduction link

https://ant.design/components/layout-cn/

Steps to reproduce

侧边栏收缩后,下拉菜单仍然显示到页面

What is expected?

侧边栏收缩后,下拉菜单同样消失

What is actually happening?

侧边栏收缩后,下拉菜单停留在页面
image

image

@ant-design-bot
Copy link
Contributor

@ant-design-bot ant-design-bot commented Dec 13, 2017

Hello @zhayes. Please provide a online reproduction by forking this link https://u.ant.design/codesandbox-repro. Issues labeled by Need Reproduce will be closed if no activities in 7 days.

@afc163
Copy link
Member

@afc163 afc163 commented Dec 13, 2017

Menu will always respect openKeys prop, I think it is correct behavior. You can control it depends on different collapsed state.

@afc163 afc163 closed this Dec 13, 2017
@afc163 afc163 reopened this Dec 13, 2017
@zhayes
Copy link
Author

@zhayes zhayes commented Dec 13, 2017

@afc163 It's not going to happen in v2.3.1

@afc163
Copy link
Member

@afc163 afc163 commented Dec 13, 2017

Alrough we should still hide the sub-menu because there is not suitable position for it when menu is collapsed to 0px.

@afc163 afc163 added the 🐛 Bug label Dec 13, 2017
@zhayes
Copy link
Author

@zhayes zhayes commented Dec 13, 2017

@afc163 I updated the version last night, and it happened

@zhayes
Copy link
Author

@zhayes zhayes commented Dec 13, 2017

@afc163 I bound a method of onCollapse to Menu.Side.The problem has been solved for a while.

Cache re-empty

    const onCollapse=(collapsed, type) => {
        if(collapsed){
            this.setState({
                lastsideOpenkeys:this.state.sideOpenKeys,
                sideOpenKeys:[]
            })
        }else{
            this.setState({
                lastsideOpenkeys:[],
                sideOpenKeys:this.state.lastsideOpenkeys
            })
        }
    }
@zhayes
Copy link
Author

@zhayes zhayes commented Dec 13, 2017

But it's not perfect !!!!!!!!!!!!!

@wanghqwe
Copy link

@wanghqwe wanghqwe commented Feb 27, 2018

The latest version of this problem remains unsolved

@treasureDouDou
Copy link

@treasureDouDou treasureDouDou commented Mar 31, 2018

这个问题的最新版本仍未解决 +1

@wjkang
Copy link

@wjkang wjkang commented May 31, 2018

3.5.3 仍然有这个问题

@wjkang
Copy link

@wjkang wjkang commented May 31, 2018

@zhayes 你好,请问你解决这个问题了吗?

@clearloop
Copy link

@clearloop clearloop commented May 18, 2019

Warning: Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.

this warning while collapsedWidth={0}

"antd": "^3.18.1",
"react": "^16.8.6",
"react-dom": "^16.8.6"
@afc163 afc163 mentioned this issue Sep 19, 2019
5 of 14 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants