Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatch change event #214

Closed
wants to merge 1 commit into from

Conversation

luisherranz
Copy link
Contributor

GhostText was dispatching different events to simulate the user input, but not the change event. This PR adds it.

Fixes #213.

@@ -172,6 +172,7 @@ class GhostTextField {
}
}));
this.field.dispatchEvent(new KeyboardEvent('keyup'), eventOptions);
this.field.dispatchEvent(new Event('change', eventOptions));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like change is fired for every keystroke. You can use monitorEvents(document.querySelector('textarea')) to see this in the console:

Screen Shot 4

@fregante
Copy link
Owner

fregante commented Aug 15, 2021

The change event seems to unrelated to the input itself but rather to blur. The browser will still fire it after you come back to the browser and blur the field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some sites may remove listeners on blur
2 participants