@@ -256,8 +256,11 @@ class MobileSemanticsEnabler extends SemanticsEnabler {
256256 @override
257257 bool tryEnableSemantics (html.Event event) {
258258 if (_schedulePlaceholderRemoval) {
259- final bool removeNow =
260- (browserEngine != BrowserEngine .webkit || event.type == 'touchend' );
259+ // The event type can also be click for VoiceOver.
260+ final bool removeNow = (browserEngine != BrowserEngine .webkit ||
261+ event.type == 'touchend' ||
262+ event.type == 'pointerup' ||
263+ event.type == 'click' );
261264 if (removeNow) {
262265 _semanticsPlaceholder! .remove ();
263266 _semanticsPlaceholder = null ;
@@ -280,10 +283,16 @@ class MobileSemanticsEnabler extends SemanticsEnabler {
280283 return true ;
281284 }
282285
286+ // ios-safari browsers which starts sending `pointer` events instead of
287+ // `touch` events. (Tested with 12.1 which uses touch events vs 13.5
288+ // which uses pointer events.)
283289 const Set <String > kInterestingEventTypes = < String > {
284290 'click' ,
285291 'touchstart' ,
286292 'touchend' ,
293+ 'pointerdown' ,
294+ 'pointermove' ,
295+ 'pointerup' ,
287296 };
288297
289298 if (! kInterestingEventTypes.contains (event.type)) {
@@ -333,6 +342,11 @@ class MobileSemanticsEnabler extends SemanticsEnabler {
333342 final html.TouchEvent touch = event as html.TouchEvent ;
334343 activationPoint = touch.changedTouches! .first.client;
335344 break ;
345+ case 'pointerdown' :
346+ case 'pointerup' :
347+ final html.PointerEvent touch = event as html.PointerEvent ;
348+ activationPoint = new html.Point (touch.client.x, touch.client.y);
349+ break ;
336350 default :
337351 // The event is not relevant, forward to framework as normal.
338352 return true ;
@@ -341,9 +355,11 @@ class MobileSemanticsEnabler extends SemanticsEnabler {
341355 final html.Rectangle <num > activatingElementRect =
342356 domRenderer.glassPaneElement! .getBoundingClientRect ();
343357 final double midX = (activatingElementRect.left +
344- (activatingElementRect.right - activatingElementRect.left) / 2 ).toDouble ();
358+ (activatingElementRect.right - activatingElementRect.left) / 2 )
359+ .toDouble ();
345360 final double midY = (activatingElementRect.top +
346- (activatingElementRect.bottom - activatingElementRect.top) / 2 ).toDouble ();
361+ (activatingElementRect.bottom - activatingElementRect.top) / 2 )
362+ .toDouble ();
347363 final double deltaX = activationPoint.x.toDouble () - midX;
348364 final double deltaY = activationPoint.y.toDouble () - midY;
349365 final double deltaSquared = deltaX * deltaX + deltaY * deltaY;
0 commit comments