woofers / react-sheet-slide

🏞️ 🎢 🛝 A responsive React draggable sheet and dialog component
https://jaxs.onl/react-sheet-slide/
35 stars 5 forks source link

Unable to set scrollbar offset to other elements #11

Open robertpiosik opened 2 months ago

robertpiosik commented 2 months ago

Hi, it's currently impossible to set scrollbar offsets on other fixed elements, padding right is somewhat cleared anytime react-sheet-slide sets its styles on body.

woofers commented 2 months ago

@robertpiosik Not sure I fully understand the use-case but react-sheet-slide will add padding to the body for 2 reasons:

This can be overridden by using using a CSS selector with more specificity like:

body:not([attr]):not([attr="value"]) { 
  padding: 35px !important
}

By adding the 2 attribute selectors, this style will apply consistent padding regardless of the modal state. Alternatively the padding could just be moved in a div that is a direct child of the body which is what I would recommend. Hope this helps.

robertpiosik commented 2 months ago

To clarify, I can't accommodate for layout shift on any child of body. While I can set padding-left or any other property without a problem, padding-right gets cleared.