File tree Expand file tree Collapse file tree 2 files changed +28
-9
lines changed Expand file tree Collapse file tree 2 files changed +28
-9
lines changed Original file line number Diff line number Diff line change 1- import type { Config } from '../interface' ;
2-
3- import { now , pointerCoord } from './helpers' ;
1+ import type { Config } from '../../interface' ;
2+ import { now , pointerCoord } from '../helpers' ;
43
54export const startTapClick = ( config : Config ) => {
65 let lastTouch = - MOUSE_WAIT * 10 ;
@@ -25,6 +24,11 @@ export const startTapClick = (config: Config) => {
2524 } ;
2625
2726 const onMouseDown = ( ev : MouseEvent ) => {
27+ // Ignore right clicks
28+ if ( ev . button === 2 ) {
29+ return ;
30+ }
31+
2832 const t = now ( ev ) - MOUSE_WAIT ;
2933 if ( lastTouch < t ) {
3034 pointerDown ( ev ) ;
@@ -38,10 +42,6 @@ export const startTapClick = (config: Config) => {
3842 }
3943 } ;
4044
41- const onContextMenu = ( ev : MouseEvent ) => {
42- pointerUp ( ev ) ;
43- } ;
44-
4545 const cancelActive = ( ) => {
4646 clearTimeout ( activeDefer ) ;
4747 activeDefer = undefined ;
@@ -161,8 +161,6 @@ export const startTapClick = (config: Config) => {
161161
162162 doc . addEventListener ( 'mousedown' , onMouseDown , true ) ;
163163 doc . addEventListener ( 'mouseup' , onMouseUp , true ) ;
164-
165- doc . addEventListener ( 'contextmenu' , onContextMenu , true ) ;
166164} ;
167165
168166const getActivatableTarget = ( ev : UIEvent ) : any => {
Original file line number Diff line number Diff line change 1+ import { test } from '@utils/test/playwright' ;
2+
3+ test . describe ( 'tap click utility' , ( ) => {
4+ test ( 'it should apply activated class when clicking element' , async ( { page } ) => {
5+ await page . setContent ( `
6+ <ion-app>
7+ <button class="ion-activatable">Click Me</button>
8+ </ion-app>
9+ ` ) ;
10+
11+ const button = page . locator ( 'button' ) ;
12+ const box = await button . boundingBox ( ) ! ;
13+
14+ if ( box ) {
15+ await page . mouse . move ( box . x + box . width / 2 , box . y + box . height / 2 ) ;
16+ await page . mouse . down ( ) ;
17+ }
18+
19+ await page . waitForSelector ( 'button.ion-activated' ) ;
20+ } ) ;
21+ } ) ;
You can’t perform that action at this time.
0 commit comments