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

[NUI] If the view had focus when it was unparented, the focus is cleared. #4654

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Tizen.NUI/src/public/BaseComponents/ViewInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,11 @@ internal IntPtr GetPtrfromView()

internal void RemoveChild(View child)
{
// If the view had focus, it clears focus.
if (child == FocusManager.Instance.GetCurrentFocusView())
{
FocusManager.Instance.ClearFocus();
}
// Do actual child removal
Interop.Actor.Remove(SwigCPtr, View.getCPtr(child));
if (NDalicPINVOKE.SWIGPendingException.Pending)
Expand Down
6 changes: 6 additions & 0 deletions src/Tizen.NUI/src/public/Common/Layer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,12 @@ public override void Remove(View child)
Tizen.Log.Error("NUI", "You have deleted a view that is not a child of this layer.");
return;
}
// If the view had focus, it clears focus.
if (child == FocusManager.Instance.GetCurrentFocusView())
{
FocusManager.Instance.ClearFocus();
}

Interop.Actor.Remove(SwigCPtr, View.getCPtr(child));
if (NDalicPINVOKE.SWIGPendingException.Pending)
throw NDalicPINVOKE.SWIGPendingException.Retrieve();
Expand Down