pradel / react-responsive-modal

Simple responsive react modal
https://react-responsive-modal.leopradel.com/
MIT License
604 stars 95 forks source link

feat: reserveScrollBarGap option on body-scroll-lock #475

Closed alexkrautmann closed 2 years ago

alexkrautmann commented 3 years ago

From the body-scroll-lock README:

If the overflow property of the body is set to hidden, the body widens by the width of the scrollbar. This produces an unpleasant flickering effect, especially on websites with centered content. If the reserveScrollBarGap option is set, this gap is filled by a padding-right on the body element.

Without reserveScrollBarGap (current behavior): without-reserveScrollBarGap

With reserveScrollBarGap: with-reserveScrollBarGap

alexkrautmann commented 3 years ago

I can also make this behavior configurable via a prop, let me know if you think that makes sense.

pradel commented 3 years ago

@alexkrautmann thanks for the pr it looks like a great addition! Would be great to make it configurable via a prop indeed :)

pradel commented 3 years ago

I also think that by default the value should be false (to avoid being a breaking change.)

codecov[bot] commented 3 years ago

Codecov Report

Merging #475 (a9c0825) into master (23cccc6) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #475   +/-   ##
=======================================
  Coverage   97.20%   97.20%           
=======================================
  Files           6        6           
  Lines         179      179           
  Branches       66       65    -1     
=======================================
  Hits          174      174           
  Misses          5        5           
Impacted Files Coverage Δ
react-responsive-modal/src/useScrollLock.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 23cccc6...a9c0825. Read the comment docs.

evisotskiy commented 2 years ago

Hi guys! Look forward to this addition! Do you know when it will be finished?

pradel commented 2 years ago

closing in favor of https://github.com/pradel/react-responsive-modal/pull/484