fix: eventListener in input_suffix_offset.js (#2053)

This commit is contained in:
Livio Amstutz 2021-07-21 11:23:55 +02:00 committed by GitHub
parent 6e32bb9fdd
commit e89b2be1f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,10 @@
const suffix = document.getElementById('default-login-suffix');
const suffixInput = document.getElementsByClassName('lgn-suffix-input')[0];
calculateOffset();
suffix.addEventListener("DOMCharacterDataModified", calculateOffset);
if (suffix && suffixInput) {
calculateOffset();
suffix.addEventListener("DOMCharacterDataModified", calculateOffset);
}
function calculateOffset() {
// add suffix width to inner right padding of the input field