Bug 245959 - REGRESSION (iOS 16): AR QuickLook banner tap event no longer propagated to anchor if not attached to DOM
Summary: REGRESSION (iOS 16): AR QuickLook banner tap event no longer propagated to an...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari 16
Hardware: iPhone / iPad iOS 16
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-10-03 04:42 PDT by Miles
Modified: 2022-11-08 13:54 PST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miles 2022-10-03 04:42:34 PDT
It appears Safari iOS16 is no longer propagating the '_apple_ar_quicklook_button_tapped' ARQL 'message' event to the originating anchor element when the anchor is not attached to the DOM.

It is possible to use JavaScript to create an 'a' element, set the appropriate 'rel' and 'href' attributes and invoke the 'click()' method to initialise an ARQL session.

The originating anchor element can listen for a 'message' event with payload of '_apple_ar_quicklook_button_tapped' to indicate the user tapped the banner displayed in the ARQL session and respond appropriately.

Prior to iOS16, that anchor element did not need to be attached to the DOM to receive the ARQL 'message' event notification.

In iOS16, a detached anchor will no longer receive the ARQL 'message' event.

The solution is to attach the anchor element to the DOM, and then in iOS16 it will once again receive the ARQL 'message' event.

Demo:
https://ios16-arql-banner-issue.glitch.me/

First example: the anchor element is defined on the page. Interaction with ARQL banner is captured through message event listener. This works in iOS16 fine.

Second example: the 'Launch Default' button triggers the click() method of the default anchor. ARQL opens. Interaction with banner is captured. Works fine in iOS16.

Third example: the 'Launch Detached' button uses JavaScript to create a new anchor element, assigns necessary attributes, and triggers click() method, without attaching element to the DOM. In iOS16, ARQL opens, banner is displayed, but clicks on banner do not propagate the message event to the detached element. This used to (and still does) work fine in iOS15, but not in iOS16.

Fourth example; The 'Launch Attached' button uses JavaScript to create a new anchor element, but also attaches it to the DOM by appending to body. ARQL opens, the banner displays, and banner clicks do indeed get propagated to the anchor's event listener and can respond appropriately. This now works in iOS16.


This could potentially have broken many sites utilising ARQL with banners.

There is a work-around.

But was this intentional or an oversight?
Comment 1 Miles 2022-10-03 04:45:15 PDT
Further discussion can be found on the Model-Viewer thread here:
https://github.com/google/model-viewer/discussions/2755
Comment 2 Radar WebKit Bug Importer 2022-10-09 13:57:15 PDT
<rdar://problem/100952298>
Comment 3 Richard Robinson 2022-11-07 15:33:02 PST
Pull request: https://github.com/WebKit/WebKit/pull/6226
Comment 4 EWS 2022-11-08 13:54:02 PST
Committed 256462@main (a203e214d6b8): <https://commits.webkit.org/256462@main>

Reviewed commits have been landed. Closing PR #6226 and removing active labels.