diff --git a/src/web/handlers/NativeViewGestureHandler.ts b/src/web/handlers/NativeViewGestureHandler.ts index 767a385e6d..f3718af76b 100644 --- a/src/web/handlers/NativeViewGestureHandler.ts +++ b/src/web/handlers/NativeViewGestureHandler.ts @@ -28,15 +28,10 @@ export default class NativeViewGestureHandler extends GestureHandler { const view = this.delegate.getView() as HTMLElement; view.style['touchAction'] = 'auto'; - //@ts-ignore Turns on defualt touch behavior on Safari view.style['WebkitTouchCallout'] = 'auto'; - if (view.hasAttribute('role')) { - this.buttonRole = true; - } else { - this.buttonRole = false; - } + this.buttonRole = view.getAttribute('role') === 'button'; } public updateGestureConfig({ enabled = true, ...props }: Config): void { @@ -164,4 +159,8 @@ export default class NativeViewGestureHandler extends GestureHandler { public disallowsInterruption(): boolean { return this.disallowInterruption; } + + public isButton(): boolean { + return this.buttonRole; + } } diff --git a/src/web/tools/InteractionManager.ts b/src/web/tools/InteractionManager.ts index 55df13b033..1443939f12 100644 --- a/src/web/tools/InteractionManager.ts +++ b/src/web/tools/InteractionManager.ts @@ -1,4 +1,6 @@ +import { State } from '../../State'; import GestureHandler from '../handlers/GestureHandler'; +import NativeViewGestureHandler from '../handlers/NativeViewGestureHandler'; import { Config, Handler } from '../interfaces'; export default class InteractionManager { @@ -102,10 +104,13 @@ export default class InteractionManager { public shouldHandlerBeCancelledBy( _handler: GestureHandler, - _otherHandler: GestureHandler + otherHandler: GestureHandler ): boolean { - //TODO: Implement logic - return false; + return ( + otherHandler instanceof NativeViewGestureHandler && + otherHandler.getState() === State.ACTIVE && + !otherHandler.isButton() + ); } public dropRelationsForHandlerWithTag(handlerTag: number): void {