The issue of Web Push notifications not routing users to the correct URL on click in iOS PWAs has been reported. Initially thought to be an incompatibility in the code at service-worker.js.erb, it is now believed to be a bug in iOS (WebKit bug #252544). A WebKit engineer, Brady Eidson, has identified the issue and submitted a PR to fix it (WebKit PR #11848). According to pmusaraj, this issue is fixed in the current version of iOS (16.5), and they can no longer reproduce the issue. pmusaraj is seeking confirmation from Falco and merefield if they also experience the fix.
When you receive a push notification on the iOS PWA it will correctly open the correct PWA for you.
However, if it’s open already, it won’t route you to the correct target URL of the notification, like for example the post URL on a notification for a reply.
They key piece there is probably this comment from Brady Eidson (Webkit engineer):
In my test case it’s working because I’m postMessaging to a new client opened via clients.openWindow
If I attempted to matchAll and reuse an existing window client, I would fall into this same trap.