vaadin / web-components

A set of high-quality standards based web components for enterprise web applications. Part of Vaadin 20+
https://vaadin.com/docs/latest/components
429 stars 82 forks source link

[notification] Wrong positioning on iOS when zoom is changed #4320

Open knoobie opened 1 year ago

knoobie commented 1 year ago

Description

iOS 15 bottom-end notification is shown on the whole body, because of the narrow spacing by default. (Good!)

26008D2A-5781-4BC6-B347-3B1A03AA7B33

iOS 16 beta2 on the other hand shows the notification only in the bottom right corner.. which in turn is a huge problem if the notification has more text (I can't share a real application public with it, but it looks horrible)

8173AE6C-7C79-41AC-9ADC-5E3A069364AC

I'm not sure if you are already wanna do something about it, or wait until iOS 16 is final. I wanted to mention it because I had to test different iOS versions with our application, because of a problem in iOS 15 that is fixed in iOS 16..

Expected outcome

The notification is shown like in iOS 15

Minimal reproducible example

https://vaadin.com/docs/latest/example?embed=notification-position-wc.js&import=component/notification/notification-position.ts

Click bottom-end and expect a full-sized notification like in iOS 15

Steps to reproduce

See example

Environment

Vaadin version(s): 23.1 OS: iPhone / iOS 15.5 (ok) / iOS 16 public beta 2 (failure)

Browsers

Safari on iOS

web-padawan commented 1 year ago

Thanks for the issue. To me it seems like the following style no longer applies:

https://github.com/vaadin/web-components/blob/d24f64f977cc0d2ef2c706c25f6f1aa92ea4719e/packages/notification/src/vaadin-notification.js#L62

web-padawan commented 1 year ago

@knoobie Could you please let me know which device resolution do you have on iOS 16? I wonder if that can be bigger than the hardcoded 420px breakpoint that we have here:

https://github.com/vaadin/web-components/blob/d24f64f977cc0d2ef2c706c25f6f1aa92ea4719e/packages/notification/src/vaadin-notification.js#L59

According to this list, at least iPhone 13 Pro Max has 428px screen width, which is bigger.

knoobie commented 1 year ago

The problem is in front of the device :) my colleague with iOS 16 had page zoom 85% configured on iOS to get a better viewing experience on safari.. making totally weird things with the resolution..

See: DE839CC2-9831-410B-8E1C-49488FA9128B

https://www.rapidtables.com/web/tools/window-size.html

The same with an iPhone 12 pro 100% (no zoom) shows 390px for both inner and outer.. and the problem is gone.. and not related to the iOS version at all.. could reproduce the same with iOS 15

web-padawan commented 1 year ago

my colleague with iOS 16 had page zoom 85% configured

Oh, thanks. Renamed the issue accordingly.

sissbruecker commented 1 year ago

Just to reference what the actual problem is, as it was not clear during grooming. The bottom-end notification uses a certain percentage of the screen width by default, which causes it to grow in height for long-form content if the screen has a small size that's still larger than the configured mobile breakpoint:

Bildschirmfoto 2022-08-10 um 09 49 49

knoobie commented 1 year ago

Thanks Sascha!

jouni commented 1 year ago

Not sure how we’ll fix this, but the original/current implementation has never really been ideal for this exact reason, that there’s an arbitrary viewport width after which the width is split into three columns.

I think all top/middle/bottom positions should be in the same “stack” (single column), and only the alignment would be different depending on the position (start/center/end). The best practice is in any case be that you only use max 2 positions in your app.

knoobie commented 1 year ago

As workaround, I'm probably going to increase the 420px to 600px in my CSS - in 2022 this sounds like the better "low resolution" for all kind of small devices, but that's probably not a good way for a framework to fix the underlying problem with all the different media queries and problems arising from it.