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

DragValue edit is discarded when clicked off #2818

Closed
Barugon opened this issue Mar 17, 2023 · 7 comments · Fixed by #2880
Closed

DragValue edit is discarded when clicked off #2818

Barugon opened this issue Mar 17, 2023 · 7 comments · Fixed by #2880
Labels
bug Something is broken

Comments

@Barugon
Copy link
Contributor

Barugon commented Mar 17, 2023

Describe the bug
If I click a DragValue and type in a new value then that new value is discarded if I click on another DragValue or TextEdit.

Video: https://youtube.com/shorts/_wxqB0XjkIY

@Barugon Barugon added the bug Something is broken label Mar 17, 2023
@paul-hansen
Copy link

paul-hansen commented Mar 23, 2023

This is really annoying when you want to edit a list of values with the keyboard by tabbing through them. The only way to make the changes save is to hit the return key, which resets the tabbing state so you have to tab back to where you were from the start.

For example, I have this Ui:
image

I would like to be able to select the first value (translation.x), type the new value, hit tab, type the next value, hit tab, etc. Currently that's not possible as it doesn't save the values you typed when you hit tab.

This used to work so likely a regression.

@Barugon
Copy link
Contributor Author

Barugon commented Mar 23, 2023

I'm using the return key to mean "Ok" when displaying a dialog (standard OS behavior) so using it to enter a single value is not good.

This used to work so likely a regression.

This is for sure a regression.

@paul-hansen
Copy link

Looks like it was introduced in this commit: b40dba1

Used git bisect and tested with the hello_world example to find the first commit where it wasn't working. The drag value created by the Slider in the example is affected so it made a good test since DragValue isn't used in the examples directly.

@Barugon
Copy link
Contributor Author

Barugon commented Apr 6, 2023

The problem here seems to be that Memory doesn't see that the TextEdit has lost focus.

@Barugon
Copy link
Contributor Author

Barugon commented Apr 6, 2023

Okay, I found the culprit. If you click on another DragValue or TextEdit then Memory::stop_text_input gets called, which sets the focus ID to None. This happens before this check, so is_kb_editing is false, which essentially kills the edit session.

Clicking on other widgets (e.g. Label) does not call Memory::stop_text_input, which allows Memory::surrender_focus to be executed correctly, resulting in the correct behavior.

Simply commenting out this line fixes the issue but I don't know if there would be any other issues because of it.
@emilk

[edit] Doesn't fix tabbing.

@Barugon
Copy link
Contributor Author

Barugon commented Apr 6, 2023

Tabbing between DragValues also disregards any edit.

@Barugon
Copy link
Contributor Author

Barugon commented Apr 6, 2023

I honestly feel that #2688 is just too problematic and should be reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
2 participants