-
-
Notifications
You must be signed in to change notification settings - Fork 538
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
Text input example drops keys #287
Comments
Yes, I can confirm that. I've got the same behavior here. Works ok if you type slowly thou. |
You are right, typing in a text input can drop keys. It actually happens because every value change is sent to the server where the event is processed and the new value is sent back to the client. I implemented this roundtrip because Quasar's QToggle simply wouldn't change its state when clicking on it even though the event was sent to the server. Somehow I had to send the updated value back to the client for it to move. While this technique might be needed for some elements for whatever reason, it might not be necessary for others. Apparently we don't need to send the new value for a QInput. So I'll introduce an option in NiceGUI's |
I checked the behavior for all elements deriving from with ui.row():
ui.checkbox('Checkbox')
ui.switch('Switch')
with ui.row():
ui.radio(['A', 'B', 'C'])
ui.select(['A', 'B', 'C'])
ui.toggle(['A', 'B', 'C'])
with ui.row():
ui.input('Input')
ui.number('Number')
ui.color_input('Color input')
with ui.row():
with ui.menu() as menu:
ui.menu_item('Ok')
ui.button('Menu', on_click=menu.open)
with ui.dialog() as dialog:
ui.button('Ok', on_click=dialog.close)
ui.button('Dialog', on_click=dialog.open)
with ui.row().classes('w-96'):
lp = ui.linear_progress()
cp = ui.circular_progress()
ui.slider(min=0, max=1, step=0.1).bind_value_to(lp, 'value').bind_value_to(cp, 'value')
with ui.row():
ui.date()
ui.time() I tried it once with sending changed values back to the client and once without.
So I guess we should treat |
Updating on blur doesn't work well. When throttling the network connection, delayed messages from the server are messing up the user experience. |
Hello! I've made a fix for this issue. Please review: #306 |
…ug#287-Text-input-example-drops-keys
Based on @FI-Mihej's PR (see discussion over at #306) I came up with a solution that might be the essence of #306 without introducing too much change of behavior and/or API: https://github.com/zauberzeug/nicegui/tree/no_loopback_for_input The key changes are as follows:
The last point was the missing piece: The client needs to listen to the change event and set the value directly. Otherwise the element would need to wait for a server response. What do you think? |
This issue is also biting us quite hard: when using |
…auberzeug#287-Text-input-example-drops-keys" This reverts commit f347b37, reversing changes made to 0fb1051.
This reverts commit 0fb1051.
…xample-drops-keys
#287 Text input example drops keys
Some last minute tests before the release uncovered major drawbacks with the new implementation. We hope to find a solution as soon as possible. Sorry for the delay. |
I pushed a possible fix to https://github.com/zauberzeug/nicegui/tree/loopback. |
The fix from 061b388 is working nicely. |
v1.1.5 has just been released. |
If you type quickly in the Text Input example on the API Reference page, you can see that it drops some characters. This makes it almost completely unusable in practice.
The text was updated successfully, but these errors were encountered: