ios – CSS-Tricks https://css-tricks.com Tips, Tricks, and Techniques on using Cascading Style Sheets. Wed, 23 Nov 2022 14:25:06 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 https://i0.wp.com/css-tricks.com/wp-content/uploads/2021/07/star.png?fit=32%2C32&ssl=1 ios – CSS-Tricks https://css-tricks.com 32 32 45537868 Apple Messages & Color Contrast https://css-tricks.com/apple-messages-color-contrast/ https://css-tricks.com/apple-messages-color-contrast/#comments Wed, 23 Nov 2022 14:25:03 +0000 https://css-tricks.com/?p=375343 Well, color me this! I was griping to myself last night about just how gosh dang hard it is to read text messages in Apple Messages. You know, not the blue bubbles that you get when messaging other iPhone users. …


Apple Messages & Color Contrast originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
Well, color me this! I was griping to myself last night about just how gosh dang hard it is to read text messages in Apple Messages. You know, not the blue bubbles that you get when messaging other iPhone users. Those are iMessages.

What I’m talking about are the green bubbles you get when messaging non-iPhone users. Those are standard text messages.

iMessage (left) and text message (right)

Let’s run the green through a contrast checker to see what’s up.

Permalink

Oomph. Now I know why I always reach for my reading glasses when a text message pops up. That 2.17:1 ratio is below the WCAG 2.0 AA requirement of 4.5:1 and wayyyyy below the AAA level of 7:1.

Turns out I’m not the only one griping. A quick search turned up a little trove of news and blog posts — some as recent as last week — about the readability of those green text message bubbles.

I’m no conspiracy theorist and like to give benefit to doubt. Buuuuut…

Apple Messages in iOS 6 (left) and iOS 7 (right)
Credit: Phoceis
  • iOS 6: Dark text on a green gradient background
  • iOS 7: White text on a #5AB539 background (or something close to it)
  • iOS 16.1: White text on a #6ACC46 background

That second one is based on old screenshots and might not be the most accurate color value. But still, the transition from iOS 6 with dark text to what we have today in iOS 16.1 shows a clear regression. I’d like think the design team checked the updated values against WCAG guidelines, sure, but at least against their own Human Interface Guidelines.

The current green background (#65C466) appears to be different than what is listed as the green “system color” (#30D158, converted from a RGB of 48, 209, 88) in the iOS palette listed in the guidelines. But it’s not like that gets us any closer to a passing WCAG AA or AAA rating.

Permalink

🤷‍♂️


Apple Messages & Color Contrast originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/apple-messages-color-contrast/feed/ 6 375343
On Browser-Specific URL Schemes https://css-tricks.com/on-browser-specific-url-schemes/ https://css-tricks.com/on-browser-specific-url-schemes/#comments Tue, 26 Oct 2021 20:06:29 +0000 https://css-tricks.com/?p=354365 We’ve covered URL schemes:

A URL Scheme is like “http://…” or “ftp://…”. Those seem like a very low-level concept that you don’t have much control over, but actually, you do!

I’d call it non-trivial, but developers can register new …


On Browser-Specific URL Schemes originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
We’ve covered URL schemes:

A URL Scheme is like “http://…” or “ftp://…”. Those seem like a very low-level concept that you don’t have much control over, but actually, you do!

I’d call it non-trivial, but developers can register new URL schemes in apps that users install. Back in 2017, Microsoft Edge did this:

microsoft-edge:// 

If you use that, the behavior is to open the URL in Microsoft Edge — even if you’ve chosen a different default browser. So if I, as a blogger, wanted to essentially force you to use Edge for this site, I could, by starting every single URL with this URL scheme. I won’t, but I could. And so could Microsoft.

At the time, Daniel Aleksandersen wrote a program called EdgeDefelector to circumvent that behavior and explained:

I don’t hate Microsoft Edge — maybe you do! — but I do believe users who have bothered to configure a different default web browser should be allowed to keep using that default web browser. 

This has come back into the public eye a bit as the Brave browser now supports the microsoft-edge:// URL scheme. Apparently, not only does an app need to register a URL scheme, but other apps that support clicks-on-links need to honor it too. Firefox is also thinking of adding it. I think the risk of not supporting the URL scheme is that clicks on links like that could do nothing instead of actually opening the URL.

A lot of the talk is about Windows 11. But here on my Mac, I see this URL scheme do what it intends across all these browsers.

Safari
Chrome
Firefox
Brave

Daniel goes further:

So, how did we get here? Until the release of iOS version 14 in September 2020, you couldn’t change the default web browser on iPhones and iPads. Google has many apps for iOS, including a shell for its Chrome browser. To tie all its apps together, Google introduced a googlechrome: URL scheme in February 2014. It could use these links to direct you from its Search or Mail app and over to Chrome instead of Apple’s Safari browser.

Here’s my iPhone 13 opening googlechrome://css-tricks.com with and without Google Chrome installed.

iOS Safari with Google Chrome installed
iOS Safari without Google Chrome installed

Seems like that would be Google’s sin, but it is apparently Apple that allowed it on iOS. Daniel once more:

The original sin was Apple’s, but Microsoft is gulping the juice of the apple with gusto.

I’m not as boned up on all this as I should be, but I think if I made software that was involved here, I’d be tempted to intercept these URL schemes and have them open in the browser the user is already in. The web is the web, there should be no reason any given URL has to open in any specific browser.


On Browser-Specific URL Schemes originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/on-browser-specific-url-schemes/feed/ 8 354365
Front-End Dev Shortcuts in iOS 15 https://css-tricks.com/front-end-dev-shortcuts-in-ios-15/ https://css-tricks.com/front-end-dev-shortcuts-in-ios-15/#comments Wed, 29 Sep 2021 14:51:22 +0000 https://css-tricks.com/?p=352627 I was pretty stoked when Chris shared a way to “View Source” on mobile. Sure, it’s not the same as a built-in feature but it allows iOS users like myself a way to peek at a site’s code the …


Front-End Dev Shortcuts in iOS 15 originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
I was pretty stoked when Chris shared a way to “View Source” on mobile. Sure, it’s not the same as a built-in feature but it allows iOS users like myself a way to peek at a site’s code the same way folks on Android can by prepending view-source: to a URL.

I was curious what sorts of dev-related tools might be baked right into my iPhone, so I dug around. It’s actually a perfect time to do that with iOS 15 fresh out of the oven and all.

The iOS Shortcuts app might be the most underrated app of all. It’s sorta like IFTTT or Zapier for iOS in that you get these hooks you can play around with to make one app respond to another and do things. Like dim the lights in my house when Marvin Gaye hits the HomePod. Useful stuff like that.

And guess what? Turns out there are a few pre-made Shortcuts recipes that can be useful for front-end developers. And you can grab them right in the Shortcuts app’s Gallery.

View source (for realzzz)

Of course, there’s a pre-fab shortcut to view the source of any webpage.

Now, when I’m on a webpage, I can ask Siri to view source, or open the Share Sheet to trigger the shortcut.

The option is added to the Share Sheet.
Notice the option to share the source.

This would be perfect if we have line numbers, syntax highlighting, a mono font (seriously!), zooming, and… OK, maybe it’s far from perfect.

Grab all the images on a page

This is another Shortcuts gem. Open a webpage and ask Siri to “get images from page.” Now, I’m no fan of scraping assets off webpages, especially in bulk, but not all image collection has to be nefarious.

It’s also available in the Share Sheet.
Sorry, not sorry.

Wayback Machine

How fun is this?! Someone had the idea to create a shortcut that opens the current page in the Wayback Machine to see past versions.

So cool to see that name in a list of options.
Saved 7,599 times since 2007? That’s more than once per day!

Edit webpage

I actually think this one is legitimately useful. Say you want to test content in a design and want to see exactly how it looks on mobile. This shortcut basically drops contenteditable on every element on the page.


That’s all! Again, all of these are available right in the iOS Shortcuts app in the Gallery tab. Maybe there are others. Or maybe someone’s made a cool shortcut to share with the rest of us. 😉


Front-End Dev Shortcuts in iOS 15 originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/front-end-dev-shortcuts-in-ios-15/feed/ 4 352627
iOS Browser Choice https://css-tricks.com/ios-browser-choice/ https://css-tricks.com/ios-browser-choice/#comments Tue, 28 Sep 2021 14:26:23 +0000 https://css-tricks.com/?p=352681 Just last week I got one of those really?! 🤨 faces when this fact came up in conversation amongst smart and engaged fellow web developers: there is no browser choice on iOS. It’s all Safari. You can download apps that …


iOS Browser Choice originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
Just last week I got one of those really?! 🤨 faces when this fact came up in conversation amongst smart and engaged fellow web developers: there is no browser choice on iOS. It’s all Safari. You can download apps that are named Chrome or Firefox, or anything else, but they are just veneer over Safari. If you’re viewing a website on iOS, it’s Safari.

I should probably call it what the App Store Review Guidelines call it: WebKit. I usually think it’s more clear to refer to browsers by their common names rather than the engine behind it, since each of The Big Three web browsers have distinct engines (for now anyway), but in this case, the engine is the important bit.

I’ll say how I feel: that sucks. I have this expensive computer in my pocket and it feels unfair that it is hamstrung in this very specific way of not allowing other browser engines. I also have an Apple laptop and it’s not hamstrung in that way, and I really hope it never is.

There is, of course, all sorts of nuance to this. My Apple laptop is hamstrung in that I can’t just install whatever OS I want on it unless I do it a sanctioned way. I also like the fact that there is some gatekeeping in iOS apps, and sometimes wish it was more strict. Like when I try to download simple games for my kid, and I end up downloading some game that is so laden with upsells, ads, and dark patterns that I think the developer should be in prison. I wish Apple just wouldn’t allow that garbage on the App Store at all. So that’s me wishing for more and less gatekeeping at the same time.

But what sucks about this lack of browser choice on iOS isn’t just the philosophy of gatekeeping, it’s that WebKit on iOS just isn’t that great. See Dave’s post for a rundown of just some of the problems from a day-to-day web developer perspective that I relate to. And because WebKit has literally zero competition on iOS, because Apple doesn’t allow competition, the incentive to make Safari better is much lighter than it could (should) be.

It’s not something like Google’s AMP, where if you really dislike it you can both not use it on your own sites and redirect yourself away from them on other sites. This choice is made for you.

My ability to talk intelligently about this is dwarfed by many others though, so what I really want to do is point out some of that recent writing. Allow me to pull a quote from a bunch of them…

iOS Engine Choice In Depth — Alex Russell

None of this is theoretical; needing to re-develop features through a straw, using less-secure, more poorly tested and analyzed mechanisms, has led to serious security issues in alternative iOS browsers. Apple’s policy, far from insulating responsible WebKit browsers from security issues, is a veritable bug farm for the projects wrenched between the impoverished feature set of Apple’s WebKit and the features they can securely deliver with high fidelity on every other platform.

This is, of course, a serious problem for Apple’s argument as to why it should be exclusively responsible for delivering updates to browser engines on iOS.

Chrome is the new Safari. And so are Edge and Firefox. — Niels Leenheer

The Safari and Chrome team both want to make the web safer and work hard to improve the web. But they do have different views on what the web should be.

Google is focussing on improving the web by making it more capable. To expand the relevance of the web, to go beyond what is possible today. And that also means allowing it to compete with native apps, with which the Android team surely does not always agree.

Safari seems to focus on improving the web as it currently is. To let it be a safer place, much faster and more beautiful. And if you want something more, you can use an app for that.

Browser choice on Apple’s iOS: privacy and security aspects ? Stuart Langridge

Alternative browsers on iOS aren’t just restricted to WebKit, they’re restricted to the version of WebKit which is in the current version of Safari. Not even different or more modern versions of WebKit itself are allowed.

Even motivated users who work hard to get out of the browser choice they’re forced into don’t actually get a choice; if they choose a different browser, they still get the same one. If there’s a requirement from people for something, the market can’t provide it because competition is not permitted.

Briefing to the UK Competition and Markets Authority on Apple’s iOS browser monopoly and Progressive Web Apps — Bruce Lawson

[…] these people at Echo Pharmacy, not only have they got a really great website, but they also have to build an app for iOS just because they want to send push notifications. And, perhaps ironically, given Apple’s insistence that they do all of this for security and privacy, is that if I did choose to install this app, I would also be giving it permission to access my health and fitness data, my contact info, my identifiers sensitive info, financial info, user content, user data and diagnostics. Whereas, if I had push notifications and I were using a PWA, I’d be leaking none of this data.

So, we can see that despite Apple’s claims, I cannot recommend a PWA as being an equal experience an iOS simply here because of push notifications. But it’s not just hurting current business, it’s also holding back future business.


I’ve heard precious few arguments defending Apple’s choice to only allow Safari on iOS. Vague Google can’t be trusted sentiment is the bulk of it, privacy-focused, performance forced, or both. All in all, nobody wants this complete lack of choice but Apple.

As far as I know, there isn’t any super clear language from Apple on why this requirement is in place. That would be nice to hear, because maybe then whatever the reasons are could be addressed.

We hear mind-blowing tech news all the time. I’d love to wake up one morning and have the news be “Apple now allows other browser engines on iOS.” You’ll hear a faint yesssssss in the air because I’ve screamed it so loud from my office in Bend, Oregon, you can hear it at your house.


iOS Browser Choice originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/ios-browser-choice/feed/ 6 352681
Safari 15: New UI, Theme Colors, and… a CSS-Tricks Cameo! https://css-tricks.com/safari-15-new-ui-theme-colors-and-a-css-tricks-cameo/ https://css-tricks.com/safari-15-new-ui-theme-colors-and-a-css-tricks-cameo/#comments Fri, 11 Jun 2021 21:38:48 +0000 https://css-tricks.com/?p=342429 There’s a 33-minute video (and resources) over on apple.com covering the upcoming Safari changes we saw in the WWDC keynote this year in much more detail. Look who’s got a little cameo in there:

Perhaps the most noticeable thing there …


Safari 15: New UI, Theme Colors, and… a CSS-Tricks Cameo! originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
There’s a 33-minute video (and resources) over on apple.com covering the upcoming Safari changes we saw in the WWDC keynote this year in much more detail. Look who’s got a little cameo in there:

Perhaps the most noticeable thing there in Safari 15 on iOS is URL bar at the bottom! Dave was speculating in our little Discord watch party that this probably fixes the weird issues with 100vh stuff on iOS. But I really just don’t know, we’ll have to see when it comes out and we can play with it. I’d guess the expectation is that, in order for us to do our own fixed-bottom-UI stuff, we’d be doing:

.bottom-nav { 
  position: fixed; /* maybe sticky is better if part of overall page layout? */
  bottom: 100vh; /* fallback? */
  bottom: calc(100vh - env(safe-area-inset-bottom)); /* new thing */
}

On desktop, the most noticeable visual feature is probably the theme-color meta tags.

This isn’t even a brand new Apple-only thing. This is the same <meta> tag that Chrome’s Android app has used since 2014, so you might already be sporting it on your own site. The addition is that it supports media queries.

<meta name="theme-color" 
      content="#ecd96f" 
      media="(prefers-color-scheme: light)">
<meta name="theme-color" 
      content="#0b3e05" 
      media="(prefers-color-scheme: dark)">

It’s great to see Safari get aspect-ratio and the new fancy color systems like lab() and lch() as well. Top-level await in JavaScript is great as it makes patterns like conditional imports easier.

I don’t think all this would satisfy Alex. We didn’t exactly get alternative browser engines on iOS or significant PWA enhancements (both of which would be really great to see). But I applaud it all—it’s good stuff. While I do think Google generally takes privacy more seriously than what general internet chatter would have to believe, it’s notable to compare each company’s newly-released features. If you’ll forgive a bit of cherry-picking, Google is working on FLoC, a technology very specifically designed to help targeted advertising. Apple is working on Private Relay, a technology very specifically to making web browsing untrackable.


Safari 15: New UI, Theme Colors, and… a CSS-Tricks Cameo! originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/safari-15-new-ui-theme-colors-and-a-css-tricks-cameo/feed/ 14 342429
Debugging iOS Safari https://css-tricks.com/debugging-ios-safari/ https://css-tricks.com/debugging-ios-safari/#comments Wed, 02 Jun 2021 21:15:28 +0000 https://css-tricks.com/?p=341724 How do I debug Safari on iOS?

These are my general steps, starting with not even using iOS Safari.

1. Is this just a small-screen problem?

Lemme just use the device mode in Chrome quick.

Note that this does a …


Debugging iOS Safari originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
How do I debug Safari on iOS?

These are my general steps, starting with not even using iOS Safari.

1. Is this just a small-screen problem?

Lemme just use the device mode in Chrome quick.

Note that this does a smidge more than just display your site in a smaller area: it sends the correct User Agent String and Client Hints for that device.

2. Does it seem actually specific to Safari? Lemme check Desktop Safari first since that’s just a few clicks away.

Now you’re actually using Safari, which is way closer to iOS Safari than desktop Chrome is.

3. Problem not showing here? Then the problem is actually unique to iOS Safari. Try emulation.

I happen to have a Mac, so I can have XCode installed and thus have an iOS simulator that is pretty easy to pop open. And if you can run the iOS simulator, that means you can run desktop Safari as well, and thus even have access to DevTools that can reach into the simulator.

4. I’ve seen real-device-only bugs. Sometimes you need a real device.

If you have a Mac, doing this is pretty similar to what we just did. You have to have the phone plugged in via USB (no wireless charging connection or whatever) and then you’ll see the device in that same Develop menu. Select the real device (which must have Safari open on some website) and you’ll get a DevTools instance of that website.

5. No Mac? Use an online emulator.

I have heard of people running over to Best Buy or an Apple Store to quick debug something on a display machine. But that’s — uhhhh — not super practical. You can use something like CrossBrowserTesting to do this right on the web.

They even jack Chrome DevTools in there somehow. I just did a little testing and I found the Chrome DevTools a little janky to use (a giant left panel renders, the click-to-select element feature didn’t work, and I kept losing WebSocket connection). But hey, it’s cool that it’s possible.

6. No Mac and still need to test on a real device?

I didn’t think this was really possible, but then I saw Inspect. (This is not an ad, I’m just shouting this out as a very cool tool.) With Inspect, I can plug in my real iOS device via USB and get a Chrome DevTools instance for it.

Remember to change this iOS Safari (Advanced) Setting to make it work with Inspect (and probably the “normal” Safari debugging described above).

I’m running Inspect on my Mac there. I guess the only real reason I would do that is to use Chrome DevTools instead of Safari DevTools (which, fair play, I might). And it looks like there will be more reasons soon enough. For example, it will bundle React, Vue, and Angular DevTools so you even have those for on-device testing, plus Wi-Fi testing, meaning you don’t have to plug in at all.

But I feel like the real clutch feature here is that it runs on Windows. So now there is a really clear answer for web developers on Windows who need to test on a real iOS device.


Debugging iOS Safari originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/debugging-ios-safari/feed/ 4 341724
16px or Larger Text Prevents iOS Form Zoom https://css-tricks.com/16px-or-larger-text-prevents-ios-form-zoom/ https://css-tricks.com/16px-or-larger-text-prevents-ios-form-zoom/#comments Tue, 04 May 2021 21:16:04 +0000 https://css-tricks.com/?p=339455 This was a great “Today I Learned” for me from Josh W. Comeau. If the font-size of an <input> is 16px or larger, Safari on iOS will focus into the input normally. But as soon as the font-size is …


16px or Larger Text Prevents iOS Form Zoom originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
This was a great “Today I Learned” for me from Josh W. Comeau. If the font-size of an <input> is 16px or larger, Safari on iOS will focus into the input normally. But as soon as the font-size is 15px or less, the viewport will zoom into that input. Presumably, because it considers that type too small and wants you to see what you are doing. So it zooms in to help you. Accessibility. If you don’t want that, make the font big enough.

https://twitter.com/joshwcomeau/status/1379782931116351490?s=12

Here’s Josh’s exact Pen if you want to have a play yourself.

In general, I’d say I like this feature. It helps people see what they are doing and discourages super-tiny font sizes. What is a slight bummer — and I really don’t blame anyone here — is that not all typefaces are created equal in terms of readability at different sizes. For example, here’s San Francisco versus Caveat at 16px.

San Francisco on the left, Cavet on the right. Caveat looks visually much smaller even though the font-size is the same.

You can view that example in Debug Mode to see for yourself and change the font size to see what does and doesn’t zoom.


16px or Larger Text Prevents iOS Form Zoom originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/16px-or-larger-text-prevents-ios-form-zoom/feed/ 9 339455
iOS 13 Design Guidelines, Templates, and Downloads https://css-tricks.com/ios-13-design-guidelines-templates-and-downloads/ Fri, 21 Feb 2020 14:46:19 +0000 https://css-tricks.com/?p=303988 Erik Kennedy wrote up a bunch of design advice for designing for the iPhone. Like Apple’s Human Interface Guidelines, only illustrated and readable, says Erik.

This is mostly for native iOS apps kinda stuff, but it makes me …


iOS 13 Design Guidelines, Templates, and Downloads originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
Erik Kennedy wrote up a bunch of design advice for designing for the iPhone. Like Apple’s Human Interface Guidelines, only illustrated and readable, says Erik.

This is mostly for native iOS apps kinda stuff, but it makes me wonder how much of this is expected when doing a mobile Progressive Web App. On one hand, this kind of stuff looks fun to try to build on the web, and it would be kinda cool to make your web app feel super native. On the other hand, doesn’t that make it extra awkward for Android and other non-iOS platforms?

A few other thoughts:

  • How much of this stuff do you get “for free” with SwiftUI?
  • As I understand it, when you build apps with Flutter / Material, the native apps that get built do some smart cross-platform stuff, mimicking how that platform does things.

Erik also does very in-depth design training with enrollment only opening once in a while, the next opens March 4th.

To Shared LinkPermalink on CSS-Tricks


iOS 13 Design Guidelines, Templates, and Downloads originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
303988
iOS 13 Broke the Classic Pure CSS Parallax Technique https://css-tricks.com/ios-13-broke-the-classic-pure-css-parallax-technique/ https://css-tricks.com/ios-13-broke-the-classic-pure-css-parallax-technique/#comments Wed, 27 Nov 2019 15:21:58 +0000 https://css-tricks.com/?p=299464 I know. You hate parallax. You know what we should hate more? When things that used to work on the web stop working without any clear warning or idea why.

Way back in 2014, Keith Clark blogged an exceptionally clever …


iOS 13 Broke the Classic Pure CSS Parallax Technique originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
I know. You hate parallax. You know what we should hate more? When things that used to work on the web stop working without any clear warning or idea why.

Way back in 2014, Keith Clark blogged an exceptionally clever CSS trick where you essentially use a CSS transform to scale an element down affecting how it appears to scroll, then “depth correcting” it back to “normal” size. Looks like we got five years of fun out of that, but it’s stopped working in iOS 13.

Here’s a video of official simulators and the problem:

I’d like to raise my hand for un-breaking this. If we don’t watchdog for the web, everything will suffer.


iOS 13 Broke the Classic Pure CSS Parallax Technique originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/ios-13-broke-the-classic-pure-css-parallax-technique/feed/ 12 299464
Zero hands up. https://css-tricks.com/zero-hands-up/ https://css-tricks.com/zero-hands-up/#comments Wed, 02 Oct 2019 14:13:59 +0000 https://css-tricks.com/?p=296513

Asked an entire room full of webdevs yesterday if any of them knew that FF/Chrome/Opera/Brave/etc. for iOS weren't allowed to compete on engine quality.

Zero hands up.

— Alex Russell (@slightlylate) September 25, 2019

It’s worth making this clear then. …


Zero hands up. originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>

Asked an entire room full of webdevs yesterday if any of them knew that FF/Chrome/Opera/Brave/etc. for iOS weren't allowed to compete on engine quality.

Zero hands up.

— Alex Russell (@slightlylate) September 25, 2019

It’s worth making this clear then. On iOS, the only browser engine is WebKit. There are other browsers, but they can’t bring their own engine (Blink/Gecko). So, if you’re using Chrome or Firefox on iOS, it’s really the same engine Safari is using, only slightly less capable (e.g. no third-party content blocker apps work in them).

It’s worth knowing that as a developer. While Chrome supports stuff like service workers on their desktop browser and on other platforms, the browser engine made available to non-Safari browsers on iOS does not. You don’t have them there. Likewise for Firefox.


Zero hands up. originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/zero-hands-up/feed/ 14 296513
Weekly Platform News: PWA Issue on iOS, Performance Culture, Anti-Tracking in Browsers https://css-tricks.com/weekly-news-pwa-issue-on-ios-performance-culture-anti-tracking-in-browsers/ https://css-tricks.com/weekly-news-pwa-issue-on-ios-performance-culture-anti-tracking-in-browsers/#comments Fri, 17 May 2019 14:30:55 +0000 http://css-tricks.com/?p=287823 In this week's news: resolving an issue when restarting progressive web apps in iOS, why The Telegraph now vets all scripts before they make it to their codebase, and Microsoft plans to add tracking prevention to the Edge browser.


Weekly Platform News: PWA Issue on iOS, Performance Culture, Anti-Tracking in Browsers originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
Šime posts regular content for web developers on webplatform.news. Each week, he covers timely news at the intersection of development standards and the tools that make them available on the web.

Installed PWAs cannot easily be restarted on iOS

Maximiliano Firtman: On iOS, it is not possible to restart an installed PWA by closing it from the recently used apps screen and then immediately reopening it. Instead of restarting the app, iOS restores its state. This can be a problem for users if the PWA gets stuck in a broken state.

After some undefined time, the saved context seems to disappear. So if you get out of the PWA, do nothing with your phone and wait some hours to go back to the PWA, it restarts from scratch.

Instilling a performance culture at The Telegraph

Gareth Clubb: At The Telegraph (a major UK newspaper), we set up a web performance working group to tackle our “organizational” performance challenges and instill a performance culture. The group meets regularly to review third-party tags and work on improving our site’s performance.

We’ve started deferring all JavaScript (including our own) using the <script defer> attribute. This change alone nearly doubled our (un-throttled) Lighthouse performance score.

Deferring our JavaScript hasn’t skewed any existing analytics and it certainly hasn’t delayed any advertising. […] The First Ad Loaded metric improved by an average of four seconds.

We also removed 1 MB of third-party payload from our new front end. When one of our teams requests the addition of any new script, we now test the script in isolation and reject it if it degrades our metrics (first contentful paint, etc.).

When we started this process, we had a collection of very old scripts and couldn’t track the original requester. We removed those on the premise that, if they were important, people would get back in touch — no one did.

Microsoft plans to add tracking prevention to the Edge browser

Kyle Pflug: Microsoft has announced plans to add options for blocking trackers to the Edge browser. Malicious trackers would be blocked automatically, and the user would have the option to additionally block all potential trackers.

This would make Edge the fourth major browser with some form of built-in anti-tracking feature (two other major browsers, Opera and UC Browser, include ad blockers instead).

  1. In 2015, Firefox added Tracking Protection — recently renamed to Content Blocking — becoming the first major browser to protect users from third-party trackers (when browsing the web in private mode).
  2. Since 2017, Safari prevents cross-site tracking by default, through a feature called Intelligent Tracking Prevention (ITP). Users are prompted to allow tracking when they try to interact with third-party widgets on websites.

  3. Earlier this year, Samsung Internet added an experimental feature called Smart Anti-Tracking that denies third-party trackers access to cookies.

Weekly Platform News: PWA Issue on iOS, Performance Culture, Anti-Tracking in Browsers originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/weekly-news-pwa-issue-on-ios-performance-culture-anti-tracking-in-browsers/feed/ 1 287823
Weekly Platform News: Feature Policy, Signed Exchanges, iOS browsers https://css-tricks.com/weekly-platform-news-feature-policy-signed-exchanges-ios-browsers/ https://css-tricks.com/weekly-platform-news-feature-policy-signed-exchanges-ios-browsers/#comments Fri, 10 May 2019 14:22:12 +0000 http://css-tricks.com/?p=287593 👋 Hey folks! This is the first edition of a new weekly update we’ll be posting that covers timely news at the intersection of development standards and the tools that make them available on the web. We often talk about


Weekly Platform News: Feature Policy, Signed Exchanges, iOS browsers originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
👋 Hey folks! This is the first edition of a new weekly update we’ll be posting that covers timely news at the intersection of development standards and the tools that make them available on the web. We often talk about the pace of change in our industry. It’s fast and touches everything from the HTML, CSS and JavaScript we write to the landscape of browsers that renders them. Please help us welcome Šime Vidas, who will be keeping us all on the up and up with curated updates from his own blog of regular development updates, webplatform.news.

Feature Policy in Chrome

Andrew Betts: Websites can use the HTTP Feature-Policy response header to prevent third parties from secretly using powerful features such as geolocation, and to disable certain bad practices (e.g. document.write, parser-blocking JavaScript, un-optimized images).

This allows good practices to be more easily rewarded. … Search results could be badged with some approving “fast” logomark or (more controversially perhaps) get a higher result ranking if they disallow themselves certain policy-controlled behaviors.

Feature Policy is an emerging technology. See featurepolicy.info for more information about individual policies and their level of support in browsers.

Signed exchanges on Google Search

The mobile version of Google Search includes AMP results on search results pages. When the user taps on an AMP result, the AMP page loads from Google’s domain (google.com) and is displayed in the AMP Viewer.

Google Search now supports an alternative: If a website signs its AMP pages, and the visitor uses Chrome for Android, then tapping on an AMP result instead loads the signed version of the AMP page from Google’s servers, but to the user it appears as if they have navigated to the website normally.

The technology that enables this is called Signed HTTP Exchanges (SXG). See the announcement on Google Webmaster Central Blog for more details. The specification describes the following use case:

In order to speed up loading but still maintain control over its content, an HTML page in a particular origin “O.com” could tell clients to load its sub-resources from an intermediate content distributor that’s not authoritative, but require that those resources be signed by “O.com” so that the distributor couldn’t modify the resources.

Websites can add support for signed exchanges by running AMP Packager on the server side. Cloudflare has launched a free feature called “AMP Real URL” that fully automates the signing process for AMP pages served from its CDN.

Alternative iOS browsers

Henrik Joreteg: On iOS, several important APIs are limited to Safari and are not available in any of the alternative iOS browsers. These include service workers, web payments, and camera access.

Chrome for iOS supports web payments via a custom implementation. I’ve created a browser support table on HTML5test that highlights the differences between some of the popular iOS browsers.


Weekly Platform News: Feature Policy, Signed Exchanges, iOS browsers originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/weekly-platform-news-feature-policy-signed-exchanges-ios-browsers/feed/ 4 287593
Quick Tip: Debug iOS Safari on a true local emulator (or your actual iPhone/iPad) https://css-tricks.com/quick-tip-debug-ios-safari-on-a-true-local-emulator-or-your-actual-iphone-ipad/ Thu, 11 Oct 2018 14:02:22 +0000 http://css-tricks.com/?p=277308 We’ve been able to do this for years, largely for free (ignoring the costs of the computer and devices), but I’m not sure as many people know about it as they should.

TL;DR: XCode comes with a “Simulator” program you …


Quick Tip: Debug iOS Safari on a true local emulator (or your actual iPhone/iPad) originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
We’ve been able to do this for years, largely for free (ignoring the costs of the computer and devices), but I’m not sure as many people know about it as they should.

TL;DR: XCode comes with a “Simulator” program you can pop open to test in virtual iOS devices. If you then open Safari’s Develop/Debug menu, you can use its DevTools to inspect right there — also true if you plug in your real iOS device.

To Shared LinkPermalink on CSS-Tricks


Quick Tip: Debug iOS Safari on a true local emulator (or your actual iPhone/iPad) originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
277308
The Annoying Mobile Double-Tap Link Issue https://css-tricks.com/annoying-mobile-double-tap-link-issue/ https://css-tricks.com/annoying-mobile-double-tap-link-issue/#comments Sun, 09 Oct 2016 14:28:57 +0000 http://css-tricks.com/?p=246048 We had a question come up the other day on ShopTalk about regular ol’ anchor links on iOS, and some weird situation where you couldn’t just tap them once to go to the link, it required tapping the link twice. …


The Annoying Mobile Double-Tap Link Issue originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
We had a question come up the other day on ShopTalk about regular ol’ anchor links on iOS, and some weird situation where you couldn’t just tap them once to go to the link, it required tapping the link twice. I’ve experienced this myself and have been pretty confounded.

My first thought was there was some kind of bizarre unexpected JavaScript happening. Perhaps a click handler with preventDefault() on that first click and then getting removed. I couldn’t find anything like that happening though. I’m sure I tried a few more things, but ultimately gave up and used FastClick to make sure those link clicks worked. FastClick wasn’t meant to solve this problem, it’s more to solve the 300ms delay for tapping links that some mobile browsers impart so they can wait to see if you’re doing a double tap (note: not as much of a problem as it once was). Not quite the right tool for the job, but it worked.

The thing is, it wasn’t a JavaScript problem at all, it was a CSS issue.

Nicholas C. Zakas documented this ages ago:

This is where the people at Apple might have been a bit too smart. They realized that there was a lot of functionality on the web relying on hover states and so they figured out a way to deal with that in Safari for iOS. When you touch an item on a webpage, it first triggers a hover state and then triggers the “click”. The end result is that you end up seeing styles applied using :hover for a second before the click interaction happens. It’s a little startling, but it does work. So Safari on iOS very much cares about your styles that have :hover in the selector. They aren’t simply ignored.

(Thanks to Pete Droll for pointing this out to me.)

Here’s two lines of CSS that will cause the problem

a::after {
  display: none;
  content: "pseudo block!";
}
a:hover::after {
  display: inline;
}

On a browser with a cursor pointer, you’ll see the pseudo element reveal itself on :hover

But clicking that link will not prevent the link from being visited. On iOS though, tapping the link will just reveal the pseudo element. It requires a second tap to actually go to the link.

Android doesn’t seem to do this. It will quickly reveal the pseudo element, but also just go to the link as normal.

This business of adding a pseudo element to a link though… not very common right? I’d say that’s true, it’s not super common. Which I suppose is why this isn’t as well known as we might think and only bites people once in a while.

I’ve seen people use pseudo elements to do aesthetic things though, like adding a more-controlled underline to text. So if that happened on :hover only, blammo, trouble has arrived. It does appear to be on hover only by the way, not focus or active.

Update December 2019: In testing the demo here in Safari/iOS 13, it appears like the pseudo-element shows up briefly then the link is followed, not requiring a double-tap. I haven’t yet done any deeper testing across mobile platforms.

It’s not just pseudo elements

This is true for any child element. Remember the thinking behind this was situations in which additional content is shown only on hover. It’s probably more common that an actual element is in use.

For example:

...
<li>
  
  <a href="#0">I'm a thing in a list</a>

  <span class="controls">
    <button>Do Something</button>
  </span>

</li>
...
li .controls {
  visibility: hidden;
}
li:hover .controls {
  visibility: visible; 
}

Hovering over the list item reveals some controls. Because a parent element how has a hover state that reveals content, it will block the anchor link from working with a single tap.

It doesn’t have to be a parent, it could be the link itself:

<a href="http://link.com">
  Link
  <span>Extra Stuff</span>
</a>
a span {
  display: none;
}
a:hover span {
  display: inline-block;
}

Media query help

It’s tempting to be like… OK I’ll just apply these hovers on “desktop” sites and pick a media query like…

@media (min-width: 500px) {
  a span {
    display: none;
  }
  a:hover span {
    display: inline-block;
  }
}

…which works in simple tests, but browser window width isn’t the perfect way to test if you have a cursor and “normal” hovers available.

Fortunately, there is a media query for pointers that could be useful to us:

@media (pointer: fine) {
  a span {
    display: none;
  }
  a:hover span {
    display: inline-block;
  }
}

Cool.

There is also a spec for a straight-up hover media query:

@media (hover) {

}

Both of these styles of media queries worked in Chrome and Safari for me, but not Firefox (support level chart), which makes it a litttttle to risky to use, perhaps. Even JavaScript methods to detect touch are questionable, I hear, and will always be weirdly wrong on devices that support both.

UPDATE March 2019: Firefox 64 dropped in December 2018, which included support for hover media queries, making the support board a ton better for this. That’s probably the best solution here.

It’s probably best to just not rely on hover to reveal anything

The tech to work around it isn’t quite there yet.

If anything, design your site such that clicks or taps are required to reveal other things but make that as obvious as you can and don’t trap normal unwilling links inside of those elements.

Trent Walton was probably right six years ago:

Ultimately, I think seeing hover states fade away will make the web a better place. There never has been any substitute for concise content, clear interaction, and simple design. If we focus on core elements that make browsing the web great, our sites will function properly no matter how people use them.

Demo

Here’s one you can play with.


The Annoying Mobile Double-Tap Link Issue originally published on CSS-Tricks, which is part of the DigitalOcean family. You should get the newsletter.

]]>
https://css-tricks.com/annoying-mobile-double-tap-link-issue/feed/ 10 246048