@@ -23,6 +23,7 @@ export const DELAY_BEFORE_ANIMATION = 300;
2323 * @property {ButtonAnimationStyle } animationStyle
2424 * @property {boolean } shouldTap
2525 * @property {boolean } shouldWatchForRemoval
26+ * @property {boolean } tapOnce
2627 */
2728
2829/**
@@ -50,6 +51,9 @@ export default class AutofillPasswordImport extends ContentFeature {
5051
5152 #domLoaded;
5253
54+ /** @type {Set<string> } */
55+ #animatedPaths = new Set ( ) ;
56+
5357 /**
5458 * @returns {ButtonAnimationStyle }
5559 */
@@ -136,31 +140,34 @@ export default class AutofillPasswordImport extends ContentFeature {
136140 const element = await this . findSettingsElement ( ) ;
137141 return element != null
138142 ? {
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+ }
144149 : null ;
145150 } else if ( path === '/options' ) {
146151 const element = await this . findExportElement ( ) ;
147152 return element != null
148153 ? {
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+ }
154160 : null ;
155161 } else if ( path === '/intro' ) {
156162 const element = await this . findSignInButton ( ) ;
157163 return element != null
158164 ? {
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+ }
164171 : null ;
165172 } else {
166173 return null ;
@@ -398,7 +405,12 @@ export default class AutofillPasswordImport extends ContentFeature {
398405 if ( this . isSupportedPath ( path ) ) {
399406 try {
400407 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+ }
402414 } catch {
403415 console . error ( 'password-import: failed for path:' , path ) ;
404416 }
0 commit comments