bem-components
bem-components copied to clipboard
Wrong popup positioning during window resize
How to reproduce:
- open https://jsfiddle.net/ze4rn61k/1/
- be sure that button in the html pan is visible and far enough from window border
- press the button (you should see a popup) and start to minmize window from right to left
Expected result: popup should be the same after resize Actual result: popup is corrupted
Correct popup view (before resize):

Corrupted popup view (after resize):

If you want to have the same predictable size you'll have to fix it by yourself, for instance in css.
Do you really think it's correct behaviour?
I can't specify width in css because different popups have different content - so different width. I beleave that look of popup should be the same regardless of window border position.
What if you specify width via %? How it can be the same independently from window size?
It looks like we completely misunderstand each other. How width of popup can depend on window size? Even not on window size, but on window border position. Did you try to reproduce it yourself?
I think that after window resize the popup should look like this:
(right border of the image is right border of browser window)
How width of popup can depend on window size?
.popup { width : 50vw }
What about border. I still don't understand what you mean. Need some time to realize.
.popup { width : 50vw }
Well, such behaviour depends on user's wish, not on library's bugs)
In the example on jsfiddle (link above) width of popup depends on window border position when popup's target is outside the viewport (completely or partly).
May be @tadatuta The Great will be able to understand me)
Well, looks like the request may be rephrased as not to resize popup until there's enough space for it on a page?
Well, bem-components does not change the popup's width, only left and top props. Maybe, we should just set right as well and/or fix left prop calculation.
@tadatuta popup isn't resized with js, it's a default browser behaviour for absolutely positioned blocks without specified size.