Skip to content

Commit

Permalink
fixme: hardcode some offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
dbajpeyi committed Nov 1, 2024
1 parent b079299 commit 297ad13
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions injected/src/features/autofill-password-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export default class AutofillPasswordImport extends ContentFeature {
start: 'scale(0.90)',
mid: 'scale(0.96)'
},
borderRadius: '100%'
borderRadius: '100%',
offsetLeft: 0.5,
offsetTop: 0.5,

Check failure on line 32 in injected/src/features/autofill-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-latest)

Unexpected trailing comma
}
}

Expand All @@ -40,7 +42,9 @@ export default class AutofillPasswordImport extends ContentFeature {
start: 'scale(1)',
mid: 'scale(1.01)'
},
borderRadius: '100%'
borderRadius: '100%',
offsetLeft: 0,
offsetTop: 0,

Check failure on line 47 in injected/src/features/autofill-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-latest)

Unexpected trailing comma
}
}

Expand All @@ -53,7 +57,9 @@ export default class AutofillPasswordImport extends ContentFeature {
start: 'scale(1)',
mid: 'scale(1.3, 1.5)'
},
borderRadius: '2px'
borderRadius: '2px',
offsetLeft: 1.25,
offsetTop: 0.1,

Check failure on line 62 in injected/src/features/autofill-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-latest)

Unexpected trailing comma
}
}

Expand Down Expand Up @@ -95,13 +101,16 @@ export default class AutofillPasswordImport extends ContentFeature {
}
}

insertOverlayElement (mainElement) {
insertOverlayElement (mainElement, offsetLeft, offsetTop) {
const overlay = document.createElement('div')
overlay.style.position = 'absolute'
overlay.style.top = `${mainElement.offsetTop}px`
overlay.style.left = `${mainElement.offsetLeft}px`
overlay.style.width = `${mainElement.offsetWidth}px`
overlay.style.height = `${mainElement.offsetHeight}px`

//FIXME: Workaround for the overlay not being positioned correctly

Check failure on line 108 in injected/src/features/autofill-password-import.js

View workflow job for this annotation

GitHub Actions / unit (ubuntu-latest)

Expected space or tab after '//' in comment
overlay.style.top = `${mainElement.offsetTop - offsetTop}px`
overlay.style.left = `${mainElement.offsetLeft - offsetLeft}px`
const dimensions = mainElement.getBoundingClientRect()
overlay.style.width = `${dimensions.width}px`
overlay.style.height = `${dimensions.height}px`

// Ensure overlay is non-interactive
overlay.style.pointerEvents = 'none'
Expand All @@ -117,7 +126,7 @@ export default class AutofillPasswordImport extends ContentFeature {
* @param {any} style
*/
animateElement (element, style) {
const overlay = this.insertOverlayElement(element)
const overlay = this.insertOverlayElement(element, style.offsetLeft, style.offsetTop)
overlay.scrollIntoView({
behavior: 'smooth',
block: 'center',
Expand Down

0 comments on commit 297ad13

Please sign in to comment.