bem-components icon indicating copy to clipboard operation
bem-components copied to clipboard

Wrong popup positioning during window resize

Open apsavin opened this issue 9 years ago • 10 comments

How to reproduce:

  1. open https://jsfiddle.net/ze4rn61k/1/
  2. be sure that button in the html pan is visible and far enough from window border
  3. 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): 2016-04-22 12 16 05

Corrupted popup view (after resize): 2016-04-22 12 17 01

apsavin avatar Apr 22 '16 09:04 apsavin

If you want to have the same predictable size you'll have to fix it by yourself, for instance in css.

dfilatov avatar Apr 22 '16 09:04 dfilatov

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.

apsavin avatar Apr 22 '16 10:04 apsavin

What if you specify width via %? How it can be the same independently from window size?

dfilatov avatar Apr 22 '16 10:04 dfilatov

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: 2016-04-22 13 18 16 (right border of the image is right border of browser window)

apsavin avatar Apr 22 '16 10:04 apsavin

How width of popup can depend on window size?

.popup { width : 50vw }

dfilatov avatar Apr 22 '16 11:04 dfilatov

What about border. I still don't understand what you mean. Need some time to realize.

dfilatov avatar Apr 22 '16 11:04 dfilatov

.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)

apsavin avatar Apr 22 '16 11:04 apsavin

Well, looks like the request may be rephrased as not to resize popup until there's enough space for it on a page?

tadatuta avatar Apr 22 '16 15:04 tadatuta

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.

apsavin avatar Apr 22 '16 16:04 apsavin

@tadatuta popup isn't resized with js, it's a default browser behaviour for absolutely positioned blocks without specified size.

dfilatov avatar Apr 23 '16 09:04 dfilatov