Skip to content

Commit

Permalink
[NUI] If the view had focus when it was unparented, the focus is clea…
Browse files Browse the repository at this point in the history
…red.

When the view is unparented, the focus is not cleared.
So, when app re-add the view and SetCurrentFocusView, app do not receiving the FocusGained event.
  • Loading branch information
JoogabYun committed Oct 13, 2022
1 parent 696dbc2 commit 6395669
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit 6395669

Please sign in to comment.