[NUI][AT-SPI] Set focus in OnAccessibilityActivated()
authorArtur Świgoń <a.swigon@samsung.com>
Tue, 11 Jul 2023 13:51:00 +0000 (15:51 +0200)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 12 Jul 2023 06:00:56 +0000 (15:00 +0900)
This aligns the behaviour of Components (derived from CustomView), and other controls, with that
of BaseComponents (and other controls with ViewAccessibilityMode.Default, backed by the C++
accessibility implementation), which set the keyboard focus on activation. Please note that in the
latter case, the implementation of View.OnAccessibilityActivated is unused, and the unrelated method
(albeit bearing the same name) Toolkit::Control::OnAccessibilityActivated is called:

bool Control::OnAccessibilityActivated()
{
  if(Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self()))
  {
    return OnKeyboardEnter();
  }
  return false;
}

So, in other words, this patch makes C# controls behave in a similar manner, i.e. set the keyboard
focus on accessibility activation.

src/Tizen.NUI/src/public/BaseComponents/CustomView.cs
src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs

index 1cb9e3f..2a2109f 100755 (executable)
@@ -501,6 +501,11 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected override bool OnAccessibilityActivated()
         {
+            if (!base.OnAccessibilityActivated())
+            {
+                return false;
+            }
+
             return OnKeyboardEnter();
         }
 
index c1ba5b3..1776e7c 100755 (executable)
@@ -562,7 +562,7 @@ namespace Tizen.NUI.BaseComponents
         [EditorBrowsable(EditorBrowsableState.Never)]
         protected virtual bool OnAccessibilityActivated()
         {
-            return false;
+            return FocusManager.Instance.SetCurrentFocusView(this);
         }
 
         /// <summary>