Bug 213953

Summary: AX: contextmenu event fired on Mac (w/VoiceOver) but not iOS (w/VoiceOver)
Product: WebKit Reporter: cookiengineer+webkit
Component: AccessibilityAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: alexander, graouts, jcraig, megan_gardner, mike, torokati44, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 13   
Hardware: All   
OS: All   
Attachments:
Description Flags
Reduced test case for contextmenu event none

cookiengineer+webkit
Reported 2020-07-03 23:15:54 PDT
Created attachment 403513 [details] Reduced test case for contextmenu event Safari mobile (on iOS) doesn't fire the "contextmenu" event on elements, and therefore doesn't allow easy integration of html custom context menus. When using addEventListener('contextmenu') on an element, by default the magnifier is always fired (even if the element doesn't have any text content). When using "-webkit-user-select: none" and "user-select: none", the magnifier is disabled - though the contextmenu event isn't fired anyhow. The attachment is a reduced test case, where other browsers on other operating systems will behave like expected, and a long-press on mobile (or right click on desktop) of an element leads to the rectangle turning green. Only WebKit/Safari on iOS seems to not allow contextmenu events.
Attachments
Reduced test case for contextmenu event (597 bytes, text/html)
2020-07-03 23:15 PDT, cookiengineer+webkit
no flags
Radar WebKit Bug Importer
Comment 1 2020-07-04 14:08:15 PDT
James Craig
Comment 2 2021-03-18 09:36:23 PDT
AX: contextmenu event fired on Mac (w/VoiceOver) but not iOS (w/VoiceOver) On Mac with VO, pressing VO+Shift+M (show contextual menu) triggers the `contextmenu` JavaScript event, equivalent to a mouse-triggered right-click or Ctrl+click. I assume this is because of a Mac implementation detail, and that it's been this way since `contextmenu` was implemented in WebKit... This is expected behavior on Mac. On iOS, there are accessibility-triggered ways to show context menus in native UI: Home Screen icons for example. VoiceOver's default gesture for this is single-finger triple-tap. It used to be long-press, as mentioned by "cookiengineer" (no relation). The iOS VO key press is the same as Mac: VO+Shift+M. Yet neither of these trigger in Safari or other WebKit views. I don't think this is purely an accessibility issue. As far as I am aware, there is no mainstream UI way to trigger a `contextmenu` event in iOS WebKit. As such, we should not add an accessibility-only way to trigger this event, as it could reveal the use of assistive technology. Perhaps this bug should be blocked on a new WebKit issue to support `contextmenu` with a mainstream gesture or keypress if appropriate. (Disclaimer: I have not fully considered the implications, so there may be unexpected downsides.)
James Craig
Comment 3 2021-03-18 12:45:18 PDT
Update, contextmenu is triggered with right-click/ctrl-click when a BT mouse is connected to iPad.
Alex
Comment 4 2023-09-26 02:09:42 PDT
"contextmenu" is not just about menus, but it is a convenient way to detect longpress on Android devices. Without it we have to use a combination of timeout hacks on pointerstart, pointerend, pointercancel, pointermove and whatnot. Would be great if iOS supported it.
Note You need to log in before you can comment on or make changes to this bug.