Skip to content

Commit

Permalink
Dispatch input event after changing an input value
Browse files Browse the repository at this point in the history
  • Loading branch information
wolandmaster committed Dec 15, 2020
1 parent a129132 commit 0e7e667
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Unique Passwords",
"short_name": "unique-passwords",
"version": "1.2.0",
"version": "1.2.1",
"description": "Generate strong and unique site-specific passwords!",
"homepage_url": "https://github.com/wolandmaster/unique-passwords-firefox",
"icons": {
Expand Down
2 changes: 2 additions & 0 deletions scripts/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
port.postMessage({ action: "setUsername", username });
} else if (msg.action === "setUsername" && usernameInput) {
usernameInput.value = msg.username;
usernameInput.dispatchEvent(new Event("input", { bubbles: true }));
} else if (msg.action === "setPassword") {
passwordInput.value = msg.password;
passwordInput.dispatchEvent(new Event("input", { bubbles: true }));
} else if (msg.action === "showPassword") {
passwordInput.type = msg.visible ? "text" : "password";
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
domain.addEventListener("input", setGenerateEnable);

// Username
port.onMessage.addListener(msg => (msg.action === "setUsername") && (username.value = msg.username));
port.onMessage.addListener(msg => (msg.action === "setUsername") && (msg.username) && (username.value = msg.username));
port.postMessage({ action: "getUsername", passwordInputId });

// Master Password
Expand Down

0 comments on commit 0e7e667

Please sign in to comment.