@@ -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 {WeakSet<Element> } */
55+ #tappedElements = new WeakSet ( ) ;
56+
5357 /**
5458 * @returns {ButtonAnimationStyle }
5559 */
@@ -140,6 +144,7 @@ export default class AutofillPasswordImport extends ContentFeature {
140144 element,
141145 shouldTap : this . #settingsButtonSettings?. shouldAutotap ?? false ,
142146 shouldWatchForRemoval : false ,
147+ tapOnce : false ,
143148 }
144149 : null ;
145150 } else if ( path === '/options' ) {
@@ -150,6 +155,7 @@ export default class AutofillPasswordImport extends ContentFeature {
150155 element,
151156 shouldTap : this . #exportButtonSettings?. shouldAutotap ?? false ,
152157 shouldWatchForRemoval : true ,
158+ tapOnce : true ,
153159 }
154160 : null ;
155161 } else if ( path === '/intro' ) {
@@ -160,6 +166,7 @@ export default class AutofillPasswordImport extends ContentFeature {
160166 element,
161167 shouldTap : this . #signInButtonSettings?. shouldAutotap ?? false ,
162168 shouldWatchForRemoval : false ,
169+ tapOnce : false ,
163170 }
164171 : null ;
165172 } else {
@@ -176,6 +183,9 @@ export default class AutofillPasswordImport extends ContentFeature {
176183 this . currentOverlay . remove ( ) ;
177184 this . currentOverlay = null ;
178185 document . removeEventListener ( 'scroll' , this ) ;
186+ if ( this . currentElementConfig ?. element ) {
187+ this . #tappedElements. delete ( this . currentElementConfig ?. element ) ;
188+ }
179189 }
180190 }
181191
@@ -398,7 +408,12 @@ export default class AutofillPasswordImport extends ContentFeature {
398408 if ( this . isSupportedPath ( path ) ) {
399409 try {
400410 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+ }
402417 } catch {
403418 console . error ( 'password-import: failed for path:' , path ) ;
404419 }
0 commit comments