ant-design / ant-design

An enterprise-class UI design language and React UI library
https://ant.design
MIT License
92.54k stars 49.84k forks source link

Anchor on Modal #21443

Closed codingwithswapnil closed 4 years ago

codingwithswapnil commented 4 years ago

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Clicking on Show Modal should work like https://ant.design/components/anchor/#Link-Props where we need to keep menus static and other content should scroll as per id of the div with #

What is expected?

Clicking on Show Modal should work like https://ant.design/components/anchor/#Link-Props where we need to keep menus static and other content should scroll as per id of the div with #

What is actually happening?

Clicking on show modal is just rendering normal page and its not adding ant-affix class after scrolling and so inline style attributes as well.

Environment Info
antd 3.26.11
React 16.10
System Windos
Browser Chrome
afc163 commented 4 years ago

https://codesandbox.io/s/hidden-haze-tz6u8

Try getContainer.

codingwithswapnil commented 4 years ago

Thank you very much for your help.

One more query here is if we are on Modal and using Anchor, the links on the left are having Links with HASH keys, and clicking on those, it changes the URL's hash part and so it closes modal, rather it should only scroll to the HASH which is default behavior of HTML.