Clear Input Focus When Enter Key is Pressed #1095
jaredlhamilton
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I think it is nice when certain inputs lose focus when the enter key is pressed, such as the NumberBox. I tested this out by adding the following code to the NumberBox.cs file under the OnKeyUp method:
Replace the line:
MoveCaretToTextEnd()
With:
FocusManager.SetFocusedElement(FocusManger.GetFocusScope(this), null);
Keyboard.ClearFocus();
HideClearButton();
Now when a number is entered and the enter key is pressed, the input is validated and the NumberBox loses focus.
Please test this out and consider adding this functionality as an option to the inputs where it makes sense to do so.
It is also nice when the escape key is pressed to restore the previously entered value. Unfortunately, I do not have a working example of this to share.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions