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

"input" event should fire synchronously when input field value changes #120

Open
robertknight opened this issue Nov 9, 2016 · 10 comments · May be fixed by #196 or minkphp/MinkSelenium2Driver#364
Open

Comments

@robertknight
Copy link

syn fires the "input" event asynchronously when typing into a field using syn.type(...). According to the spec and MDN this event should be fired synchronously as soon as the value property of the input has been updated.

@mvorisek
Copy link

mvorisek commented May 1, 2023

I am facing the same issue. Do you have any idea how to fix this lib?

@justinbmeyer
Copy link
Member

it looks like .schedule() is called here around input: https://github.com/bitovi/syn/blob/master/src/key.js#L872

@mvorisek , if you are up for pairing on this problem, I can help you fix it.

@mvorisek
Copy link

mvorisek commented May 1, 2023

@justinbmeyer thank you, I will create a repro where this issue corrupts data massively (vs. regular keyboard input) shortly.

@mvorisek
Copy link

mvorisek commented May 1, 2023

@justinbmeyer here is the repro: atk4/ui@8971618

steps to reproduce:

  1. clone and checkout repro_bitovi_syn_issue_120 branch
  2. open repro_bitovi_syn_issue_120/index.html in your browser (tested in Firefox on my side)
  3. observe text with missing letters written to the input field:
    image

I would expect Czech Republic written instead. When Czech Republic is typed using keyboard, the text is written correctly.

I belive the problem is that the text is mutated due race-condition between vue and syn.js as the input event generated by syn.js is not synchronous.

PS: I have created #196 PR which fixes this issue and the repro. Is it all it was or do some test or anything else needs to be adjusted?

@justinbmeyer
Copy link
Member

Yeah, a test would be great. You can see them in here: https://github.com/bitovi/syn/blob/master/test/test.html

@mvorisek
Copy link

mvorisek commented May 1, 2023

Can you please help me with the test and create a PR againts my PR branch? I cannot run the JS tests localy nor I am sure if I can write the test properly.

@justinbmeyer
Copy link
Member

@mvorisek , yes. Would you be open to pairing with me on it? Thanks!

@mvorisek
Copy link

mvorisek commented May 1, 2023

Thank you, I am very happy this will be fixed as the issue is quite major. Feel free to submit more changes to #196 or just reuse the fix in your own PR.

I also found some problem when using Syn.focus() which breaks Selenium and with older release the tests were passing... Investigating what events are fired by this lib and what events are fixed by regular mouse event.

Also in the git I see you were working on v1 release where you fixed a lot of things incl. CI, what is the status now? What about adding GH Actions CI and integrate the changes incrementally?

@justinbmeyer
Copy link
Member

We paused development, mostly b/c we didn't know folks have been using the library much outside of Bitovi. What have you been using it for?

Knowing folks are using it helps motivate us to keep maintaining it.

@mvorisek
Copy link

mvorisek commented May 2, 2023

This lib is used in https://github.com/minkphp/MinkSelenium2Driver/blob/master/src/Selenium2Driver.php to emulate mouse/keyboard events for Selenium testing, there are about 25k installs per day - https://packagist.org/packages/behat/mink-selenium2-driver/stats, in npm stats it is not visible, as the JS is bundled, and there are probably a lot of simillar uses.

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