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

should dispatch changeEvent after value is updated #11

Closed
hwqing opened this issue Feb 10, 2021 · 3 comments
Closed

should dispatch changeEvent after value is updated #11

hwqing opened this issue Feb 10, 2021 · 3 comments
Assignees
Labels
bug Something isn't working fixed Has been fixed.

Comments

@hwqing
Copy link

hwqing commented Feb 10, 2021

Dear,

There is an issue that in change event for INPUT, you always get the old value.
For example, if currently the value for INPUT is "abc", and then click the VK key "d", you got "abcd" in INPUT, and in the meantime, change event triggered for INPUT and in this event, if you try to get the value of INPUT, you still got "abc".

By going through your code, I found that "input.dispatchEvent(changeEvent);" was executed before "input.value = theInputValArray.join('');" which might cause this problem.

Please consider to make relevant modification.
Thank you very much.

@furcan
Copy link
Owner

furcan commented Feb 10, 2021

Hi @hwqing

Thank you for using Kioskboard.js.

I did not get the issue or your expectation clearly.

But you can find an example video below to see everything works as normal. Otherwise, please explain your issue in more detail and with examples.

Thank you.

Furkan.

Screen.Recording.2021-02-10.at.19.42.46.mp4

@furcan furcan closed this as completed Feb 10, 2021
@gabe-lucas
Copy link

gabe-lucas commented Mar 25, 2021

Hey @furcan,

I just wanted to start off by saying fantastic job on Kioskboard.
My goal is to give you a little bit of more clarification on what the issue is as I have encountered it as well.

When you're listening to the change event in JS, for example:

document.getElementById("example").addEventListener("change", (e) => {
    console.log(document.getElementById("example").value);
});

This will print the value of the statement before it is updated by Kioskboard.

My solution to this was moving the event dispatch calls after setting the input values. #18
Let me know if you have any questions.

Kind Regards!

@furcan furcan self-assigned this Apr 21, 2021
@furcan furcan added the bug Something isn't working label Apr 21, 2021
@furcan furcan reopened this Apr 21, 2021
furcan added a commit that referenced this issue Apr 21, 2021
Fixed: The dispatcher issue on the input change event has been fixed: ([#11](#11))

Fixed: The current text selection issue has been fixed: ([#19](#19))

Added: The `max` and `maxlength` attribute controls have been added: ([#17](#17))

Added: The `options` parameter has been added to the `Run()` function to set the initialize options. => `KioskBoard.Run(selector, options);`

Changed: The `selector` parameter has been changed to `selectorOrElement` that also can use an element instead of the query selector. => `KioskBoard.Run(selectorOrElement);`

Changed: The `Merge()` function has been deprecated.

Changed: Code Review.
@furcan
Copy link
Owner

furcan commented Apr 21, 2021

Hi @gabe-lucas , @hwqing

The issue has been fixed (v1.4.0)

Thanks,
Furkan.

@furcan furcan closed this as completed Apr 21, 2021
@furcan furcan added the fixed Has been fixed. label Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Has been fixed.
Projects
None yet
Development

No branches or pull requests

3 participants