@@ -23,6 +23,7 @@ export const DELAY_BEFORE_ANIMATION = 300;
23
23
* @property {ButtonAnimationStyle } animationStyle
24
24
* @property {boolean } shouldTap
25
25
* @property {boolean } shouldWatchForRemoval
26
+ * @property {boolean } tapOnce
26
27
*/
27
28
28
29
/**
@@ -50,6 +51,9 @@ export default class AutofillPasswordImport extends ContentFeature {
50
51
51
52
#domLoaded;
52
53
54
+ /** @type {WeakSet<Element> } */
55
+ #tappedElements = new WeakSet ( ) ;
56
+
53
57
/**
54
58
* @returns {ButtonAnimationStyle }
55
59
*/
@@ -140,6 +144,7 @@ export default class AutofillPasswordImport extends ContentFeature {
140
144
element,
141
145
shouldTap : this . #settingsButtonSettings?. shouldAutotap ?? false ,
142
146
shouldWatchForRemoval : false ,
147
+ tapOnce : false ,
143
148
}
144
149
: null ;
145
150
} else if ( path === '/options' ) {
@@ -150,6 +155,7 @@ export default class AutofillPasswordImport extends ContentFeature {
150
155
element,
151
156
shouldTap : this . #exportButtonSettings?. shouldAutotap ?? false ,
152
157
shouldWatchForRemoval : true ,
158
+ tapOnce : true ,
153
159
}
154
160
: null ;
155
161
} else if ( path === '/intro' ) {
@@ -160,6 +166,7 @@ export default class AutofillPasswordImport extends ContentFeature {
160
166
element,
161
167
shouldTap : this . #signInButtonSettings?. shouldAutotap ?? false ,
162
168
shouldWatchForRemoval : false ,
169
+ tapOnce : false ,
163
170
}
164
171
: null ;
165
172
} else {
@@ -176,6 +183,9 @@ export default class AutofillPasswordImport extends ContentFeature {
176
183
this . currentOverlay . remove ( ) ;
177
184
this . currentOverlay = null ;
178
185
document . removeEventListener ( 'scroll' , this ) ;
186
+ if ( this . currentElementConfig ?. element ) {
187
+ this . #tappedElements. delete ( this . currentElementConfig ?. element ) ;
188
+ }
179
189
}
180
190
}
181
191
@@ -398,7 +408,12 @@ export default class AutofillPasswordImport extends ContentFeature {
398
408
if ( this . isSupportedPath ( path ) ) {
399
409
try {
400
410
this . setCurrentElementConfig ( await this . getElementAndStyleFromPath ( path ) ) ;
401
- await this . animateOrTapElement ( ) ;
411
+ if ( this . currentElementConfig ?. element && ! this . #tappedElements. has ( this . currentElementConfig ?. element ) ) {
412
+ await this . animateOrTapElement ( ) ;
413
+ if ( this . currentElementConfig ?. shouldTap && this . currentElementConfig ?. tapOnce ) {
414
+ this . #tappedElements. add ( this . currentElementConfig . element ) ;
415
+ }
416
+ }
402
417
} catch {
403
418
console . error ( 'password-import: failed for path:' , path ) ;
404
419
}
0 commit comments