Skip to content

Commit 766ac48

Browse files
committed
fix: animate export password only once
1 parent 399ce49 commit 766ac48

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

injected/src/features/autofill-password-import.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -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} animateOnce
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
*/
@@ -140,6 +144,7 @@ export default class AutofillPasswordImport extends ContentFeature {
140144
element,
141145
shouldTap: this.#settingsButtonSettings?.shouldAutotap ?? false,
142146
shouldWatchForRemoval: false,
147+
animateOnce: 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+
animateOnce: 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+
animateOnce: false,
163170
}
164171
: null;
165172
} else {
@@ -398,7 +405,10 @@ 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.currentElementConfig?.animateOnce && !this.#animatedPaths.has(path)) {
409+
this.#animatedPaths.add(path);
410+
await this.animateOrTapElement();
411+
}
402412
} catch {
403413
console.error('password-import: failed for path:', path);
404414
}

0 commit comments

Comments
 (0)