Safari styling errors #435

Closed
opened 2021-08-03 21:56:51 +02:00 by Irev-Dev · 18 comments
Irev-Dev commented 2021-08-03 21:56:51 +02:00 (Migrated from github.com)

I've largely neglected safari and the result is there are a bunch of styling problems
image

Z issues for the login modal

image
lots of flex gaps ignored by the browser and the page leaves a gap at the bottom of the page.

image
More ignored gaps.

found by @revolter.

I've largely neglected safari and the result is there are a bunch of styling problems ![image](https://user-images.githubusercontent.com/29681384/128078055-8f74732f-2251-47d2-82bd-f68ec982702f.png) Z issues for the login modal ![image](https://user-images.githubusercontent.com/29681384/128076696-dafbace0-3845-4435-ab2d-b58a0eece758.png) lots of flex gaps ignored by the browser and the page leaves a gap at the bottom of the page. ![image](https://user-images.githubusercontent.com/29681384/128077091-54fd8dad-cd5d-4062-9f24-0cea28572da5.png) More ignored gaps. found by @revolter.
Irev-Dev commented 2021-08-03 22:06:38 +02:00 (Migrated from github.com)

yup so safari just ignores flex gaps until this year, but we probably need to refactor using padding to support older safari.
https://css-tricks.com/safari-14-1-adds-support-for-flexbox-gaps/

yup so safari just ignores flex gaps until this year, but we probably need to refactor using padding to support older safari. https://css-tricks.com/safari-14-1-adds-support-for-flexbox-gaps/
Irev-Dev commented 2021-08-07 02:30:11 +02:00 (Migrated from github.com)

Because this is all style related it would be a good first issue for someone, especially if you've used tailwind before.

Because this is all style related it would be a good first issue for someone, especially if you've used tailwind before.
Irev-Dev commented 2021-08-10 00:16:00 +02:00 (Migrated from github.com)

Wait this is a terrible issue for you right @franknoirot? don't you run Windows?

Wait this is a terrible issue for you right @franknoirot? don't you run Windows?
franknoirot commented 2021-08-10 00:18:48 +02:00 (Migrated from github.com)

@Irev-Dev I've got a MacBook for work so I think I can do it alright!

@Irev-Dev I've got a MacBook for work so I think I can do it alright!
Irev-Dev commented 2021-08-10 00:25:16 +02:00 (Migrated from github.com)

Perfect.

Perfect.
franknoirot commented 2021-08-10 05:57:12 +02:00 (Migrated from github.com)

@Irev-Dev confirmed I've been able to get my dev environment in order and use Redwood's forwarding dev command to open the site running locally from my work computer in Safari. On the hunt for some solutions, think I understand the z-index issue and will investigate the rest tomorrow.

@Irev-Dev confirmed I've been able to get my dev environment in order and use Redwood's forwarding dev command to open the site running locally from my work computer in Safari. On the hunt for some solutions, think I understand the `z-index` issue and will investigate the rest tomorrow.
franknoirot commented 2021-08-10 07:00:36 +02:00 (Migrated from github.com)

Okay so the problem with the gaps is that the gap CSS property is only supported in the absolute latest Safari version, which up until now only supported gap or the former grid-gap for elements with display: grid and no gap-like property for elements with `display: flex'.

Typically you could use an @supports (gap: 1rem) statement to detect if a browser supports a CSS property, but you can't in this case because it's a two condition support statement targeting Safari: supporting gap: 1rem in tandem with display: flex. This has sparked some fascinating discussion on the W3C CCSWG even though this particular iteration of the problem will go away as Safari users upgrade.

In the meantime, there is no CSS-only fix for this solution. As noted in the CSSWG thread, Ahmad Shadeed published a JS solution for detecting support in this blog post that explains the detection issue.

Okay so the problem with the gaps is that the `gap` CSS property is only supported in the absolute latest Safari version, which up until now only supported `gap` or the former `grid-gap` for elements with `display: grid` and no gap-like property for elements with `display: flex'. Typically you could use an `@supports (gap: 1rem)` statement to detect if a browser supports a CSS property, but you can't in this case because it's a _two condition_ support statement targeting Safari: supporting `gap: 1rem` _in tandem with_ `display: flex`. This has sparked some fascinating discussion on the [W3C CCSWG](https://github.com/w3c/csswg-drafts/issues/3559#issuecomment-621032156) even though this particular iteration of the problem will go away as Safari users upgrade. In the meantime, there is no CSS-only fix for this solution. As noted in the CSSWG thread, Ahmad Shadeed published a JS solution for detecting support in [this blog post](https://ishadeed.com/article/flexbox-gap/) that explains the detection issue.
Irev-Dev commented 2021-08-10 07:26:09 +02:00 (Migrated from github.com)

Nice investigative work @franknoirot 🕵️ ,
I was thinking that we would solve this simply by replacing the gap class currently on the parent with padding/margin on the children, bit of a pain but also very straight forward?
Or do you think that a more sophisticated solution detecting the problem and adjusting is called for?

Actually would using grid instead of flex work in most of our cases? I don't think we're using flex specific features (like grow/shrink) so maybe that would work?

Nice investigative work @franknoirot 🕵️ , I was thinking that we would solve this simply by replacing the gap class currently on the parent with padding/margin on the children, bit of a pain but also very straight forward? Or do you think that a more sophisticated solution detecting the problem and adjusting is called for? Actually would using grid instead of flex work in most of our cases? I don't think we're using flex specific features (like grow/shrink) so maybe that would work?
Irev-Dev commented 2021-08-10 11:49:41 +02:00 (Migrated from github.com)
https://twitter.com/fra_michelini/status/1425023649069867009
franknoirot commented 2021-08-10 19:25:06 +02:00 (Migrated from github.com)

@Irev-Dev yeah I'd like to see where I can get away with just converting from flex to grid and the like.

One potential reason for using the more bloated detection patch is we can remove that once support is widespread enough and have the best practice already sitting there. And since flex containers don't have collapsing margins any margin we add to their children could cause misalignment due to margins on the first and last children being applied that we would have to override, and I'm not sure if there are Tailwind classes for child selectors so those overrides will likely be custom styles anyway. But I'll do some research tonight.

@Irev-Dev yeah I'd like to see where I can get away with just converting from `flex` to `grid` and the like. One potential reason for using the more bloated detection patch is we can remove that once support is widespread enough and have the best practice already sitting there. And since `flex` containers don't have collapsing margins any margin we add to their children could cause misalignment due to margins on the first and last children being applied that we would have to override, and I'm not sure if there are Tailwind classes for child selectors so those overrides will likely be custom styles anyway. But I'll do some research tonight.
franknoirot commented 2021-08-11 05:33:18 +02:00 (Migrated from github.com)

Ugh @Irev-Dev I ran into a problem tonight. At work we keep our laptops up-to-date with the latest iOS (I'm running 14.5) and you can't downgrade, so I'm not able to recreate the gap issue. I'm trying to emulate older versions of Safari using XCode (I downloaded iOS 13.5 Simulator), but you can't use that to simulate desktop Safari, only iPad and other mobile devices.

I have been able to confirm that replacing gap TailwindCSS class names with one-sided margins on all but the first/last children is a good replacement that looks the same in other browsers, but I can't recreate the environment to see all of the issues for real right now.

Do you know of a reliable way to emulate old desktop Safari versions?

Ugh @Irev-Dev I ran into a problem tonight. At work we keep our laptops up-to-date with the latest iOS (I'm running 14.5) and you can't downgrade, so I'm not able to recreate the `gap` issue. I'm trying to emulate older versions of Safari using XCode (I downloaded iOS 13.5 Simulator), but you can't use that to simulate desktop Safari, only iPad and other mobile devices. I have been able to confirm that replacing `gap` TailwindCSS class names with one-sided margins on all but the first/last children is a good replacement that looks the same in other browsers, but I can't recreate the environment to see all of the issues for real right now. Do you know of a reliable way to emulate old desktop Safari versions?
franknoirot commented 2021-08-11 05:36:38 +02:00 (Migrated from github.com)

One good thing I will say is everything looks great on latest Safari haha, even that height issue with the IDE page is gone for me.

CadHub IDE in Safari 14.1.1
One good thing I will say is everything looks great on latest Safari haha, even that height issue with the IDE page is gone for me. <img width="1440" alt="CadHub IDE in Safari 14.1.1" src="https://user-images.githubusercontent.com/23481541/128965709-aa07bb53-80f2-4962-9862-e7d5499d0e6e.png">
revolter commented 2021-08-11 07:16:20 +02:00 (Migrated from github.com)

@franknoirot, but can you reproduce this:

image

?

It happens for me in Safari 14.1.2 (16611.3.10.1.3).

@franknoirot, but can you reproduce this: <img width="1259" alt="image" src="https://user-images.githubusercontent.com/5748627/128973360-347a9439-762c-4fc5-92ec-7f812dc0d2d2.png"> ? It happens for me in Safari 14.1.2 (16611.3.10.1.3).
franknoirot commented 2021-08-11 07:25:43 +02:00 (Migrated from github.com)

@revolter yup I can replace that! I've committed a fix to it in 68346e075a

@revolter yup I can replace that! I've committed a fix to it in https://github.com/Irev-Dev/cadhub/commit/68346e075ac2b27ba114b671c760dfc7b14112ad
revolter commented 2021-08-11 07:28:37 +02:00 (Migrated from github.com)

Oooh, I see now. I don't experience the gap issues either.

Oooh, I see now. I don't experience the gap issues either.
Irev-Dev commented 2021-08-11 10:34:03 +02:00 (Migrated from github.com)

Unless you really want to see this issue to the end @franknoirot, I might as well fix the gap issue since I still got the old version on my machine.

Good that the rest of the issues in the IDE are okay in the new version.

Unless you really want to see this issue to the end @franknoirot, I might as well fix the gap issue since I still got the old version on my machine. Good that the rest of the issues in the IDE are okay in the new version.
Irev-Dev commented 2021-08-11 10:51:29 +02:00 (Migrated from github.com)

Only done one so far but its looking promising
image
image

Only done one so far but its looking promising ![image](https://user-images.githubusercontent.com/29681384/128999155-328a2ffe-5435-4953-81b0-57b7c9d2715a.png) ![image](https://user-images.githubusercontent.com/29681384/128999575-c2015b64-d8f5-4d10-874d-003641d6b0b3.png)
franknoirot commented 2021-08-11 14:02:12 +02:00 (Migrated from github.com)

Nice! Appreciate it.

Nice! Appreciate it.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: h3n3/cadhub#435