ui icon indicating copy to clipboard operation
ui copied to clipboard

[bug]: When I open/close a dialog, a margin shift happens

Open wrsrsh opened this issue 1 year ago • 1 comments

Describe the bug

I tried setting modal={true} but that causes the dialog overlay to disappear

Affected component/components

Dialog

How to reproduce

N/A

Codesandbox/StackBlitz link

N/A

Logs

N/A

System Info

N/A

Before submitting

  • [X] I've made research efforts and searched the documentation
  • [X] I've searched for existing issues

wrsrsh avatar Oct 04 '24 12:10 wrsrsh

Just had this issue as well on mobile but it was unreproducible in a new project and eventually found out that the issue was caused by the magic ui border beam component that existed on the same page, still figuring out exactly how to fix it

odysseaspapadimas avatar Oct 04 '24 15:10 odysseaspapadimas

Same here, It was unreproducible in a new project, I fixed this issue by removing a faulty custom scrollbar. Most probably if you have this issue, it is caused by some other component or css.

Should I close the issue?

wrsrsh avatar Oct 08 '24 11:10 wrsrsh

Maybe this is not the best approach here, but I had a similar issue as the project I was working on needed to support both LTR and RTL, I added this css lines:

html body[data-scroll-locked]:not([data-scroll-no-lock]) {
  min-width: 100%;
  margin-right: 0 !important;
  overflow: inherit !important;
}

Note that I have a condition which is :not([data-scroll-no-lock]), therefore the css won't apply unless I add it manually, the reason for that is removing the scrollbar and setting the margin to zero has impcated the <Sheet/> component, so I kept the default behivor as its and when ever I wanted to remove the margin and hide the scroll I would add these lines to the component:

  useEffect(() => {
    if (props.open == true)
      document.body.setAttribute("data-scroll-no-lock", "true");
    else document.body.removeAttribute("data-scroll-no-lock");
  }, [props.open]);

Happy coding!

OmarAljoundi avatar Oct 11 '24 21:10 OmarAljoundi

Thanks Man, I will close the issue now!

wrsrsh avatar Oct 14 '24 02:10 wrsrsh