File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -339,6 +339,17 @@ export class Item extends Ion {
339
339
this . _setName ( elementRef ) ;
340
340
this . _shouldHaveReorder = ! ! reorder ;
341
341
this . id = form . nextId ( ) . toString ( ) ;
342
+
343
+ // auto add "tappable" attribute to ion-item components that have a click listener
344
+ if ( ! ( < any > renderer ) . orgListen ) {
345
+ ( < any > renderer ) . orgListen = renderer . listen ;
346
+ renderer . listen = function ( renderElement : HTMLElement , name : string , callback : Function ) : Function {
347
+ if ( name === 'click' && renderElement . setAttribute ) {
348
+ renderElement . setAttribute ( 'tappable' , '' ) ;
349
+ }
350
+ return ( < any > renderer ) . orgListen ( renderElement , name , callback ) ;
351
+ } ;
352
+ }
342
353
}
343
354
344
355
/**
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ export class MyCmpTest {
53
53
<ion-list-header>
54
54
{{title}}
55
55
</ion-list-header>
56
- <button ion-item class="e2eFrom1To2" (click)="pushFullPage()">Push to FullPage</button >
56
+ <ion-item class="e2eFrom1To2" (click)="pushFullPage()">Push to FullPage</ion-item >
57
57
<button ion-item (click)="pushPrimaryHeaderPage()">Push to PrimaryHeaderPage</button>
58
58
<button ion-item (click)="pushRedirect()">Push to Redirect</button>
59
59
<button ion-item (click)="pushTabsPage()">Push to Tabs Page</button>
Original file line number Diff line number Diff line change @@ -160,17 +160,16 @@ export const isActivatable = function (ele: HTMLElement) {
160
160
return true ;
161
161
}
162
162
163
- let attributes = ele . attributes ;
164
- for ( let i = 0 , l = attributes . length ; i < l ; i ++ ) {
165
- if ( ACTIVATABLE_ATTRIBUTES . indexOf ( attributes [ i ] . name ) > - 1 ) {
163
+ for ( let i = 0 , l = ACTIVATABLE_ATTRIBUTES . length ; i < l ; i ++ ) {
164
+ if ( ele . hasAttribute ( ACTIVATABLE_ATTRIBUTES [ i ] ) ) {
166
165
return true ;
167
166
}
168
167
}
169
168
return false ;
170
169
} ;
171
170
172
171
const ACTIVATABLE_ELEMENTS = [ 'A' , 'BUTTON' ] ;
173
- const ACTIVATABLE_ATTRIBUTES = [ 'tappable' , 'button' ] ;
172
+ const ACTIVATABLE_ATTRIBUTES = [ 'tappable' , 'ion- button' ] ;
174
173
const POINTER_TOLERANCE = 60 ;
175
174
const DISABLE_NATIVE_CLICK_AMOUNT = 2500 ;
176
175
You can’t perform that action at this time.
0 commit comments