@@ -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 {Set<string> } */
55
+ #animatedPaths = new Set ( ) ;
56
+
53
57
/**
54
58
* @returns {ButtonAnimationStyle }
55
59
*/
@@ -136,31 +140,34 @@ export default class AutofillPasswordImport extends ContentFeature {
136
140
const element = await this . findSettingsElement ( ) ;
137
141
return element != null
138
142
? {
139
- animationStyle : this . settingsButtonAnimationStyle ,
140
- element,
141
- shouldTap : this . #settingsButtonSettings?. shouldAutotap ?? false ,
142
- shouldWatchForRemoval : false ,
143
- }
143
+ animationStyle : this . settingsButtonAnimationStyle ,
144
+ element,
145
+ shouldTap : this . #settingsButtonSettings?. shouldAutotap ?? false ,
146
+ shouldWatchForRemoval : false ,
147
+ tapOnce : false ,
148
+ }
144
149
: null ;
145
150
} else if ( path === '/options' ) {
146
151
const element = await this . findExportElement ( ) ;
147
152
return element != null
148
153
? {
149
- animationStyle : this . exportButtonAnimationStyle ,
150
- element,
151
- shouldTap : this . #exportButtonSettings?. shouldAutotap ?? false ,
152
- shouldWatchForRemoval : true ,
153
- }
154
+ animationStyle : this . exportButtonAnimationStyle ,
155
+ element,
156
+ shouldTap : this . #exportButtonSettings?. shouldAutotap ?? false ,
157
+ shouldWatchForRemoval : true ,
158
+ tapOnce : true ,
159
+ }
154
160
: null ;
155
161
} else if ( path === '/intro' ) {
156
162
const element = await this . findSignInButton ( ) ;
157
163
return element != null
158
164
? {
159
- animationStyle : this . signInButtonAnimationStyle ,
160
- element,
161
- shouldTap : this . #signInButtonSettings?. shouldAutotap ?? false ,
162
- shouldWatchForRemoval : false ,
163
- }
165
+ animationStyle : this . signInButtonAnimationStyle ,
166
+ element,
167
+ shouldTap : this . #signInButtonSettings?. shouldAutotap ?? false ,
168
+ shouldWatchForRemoval : false ,
169
+ tapOnce : false ,
170
+ }
164
171
: null ;
165
172
} else {
166
173
return null ;
@@ -398,7 +405,12 @@ export default class AutofillPasswordImport extends ContentFeature {
398
405
if ( this . isSupportedPath ( path ) ) {
399
406
try {
400
407
this . setCurrentElementConfig ( await this . getElementAndStyleFromPath ( path ) ) ;
401
- await this . animateOrTapElement ( ) ;
408
+ if ( ! this . #animatedPaths. has ( path ) ) {
409
+ await this . animateOrTapElement ( ) ;
410
+ if ( this . currentElementConfig ?. shouldTap && this . currentElementConfig ?. tapOnce ) {
411
+ this . #animatedPaths. add ( path ) ;
412
+ }
413
+ }
402
414
} catch {
403
415
console . error ( 'password-import: failed for path:' , path ) ;
404
416
}
0 commit comments