[NUI][AT-SPI] Remove AccessibilityShouldReportZeroChildren()
authorArtur Świgoń <a.swigon@samsung.com>
Mon, 16 May 2022 08:08:06 +0000 (10:08 +0200)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Fri, 27 May 2022 06:02:37 +0000 (15:02 +0900)
This method originated as a hack to cut the AT-SPI tree at a specific
node in the case of compound controls (i.e. composed of multiple views
overlaid on top of each other), so that there is only one leaf node
(instead of a subtree) for Button, Slider, etc.

However, the AccessibilityHidden property was introduced to allow for
controlling which nodes should be removed from the AT-SPI tree, and has
since become the recommended solution over ShouldReportZeroChildren(),
because the latter is less flexible ("all-or-nothing" approach) and
itself requires a hack in dali-csharp-binder to make sure the highlight
frame actor is never removed from the tree.

src/Tizen.NUI.Components/Controls/Button.Internal.cs
src/Tizen.NUI.Components/Controls/Progress.cs
src/Tizen.NUI.Components/Controls/Slider.Internal.cs
src/Tizen.NUI.Components/Controls/Slider.cs
src/Tizen.NUI/src/internal/Interop/Interop.ControlDevel.cs
src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs
src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityWrappers.cs

index 69b1d69..41a6243 100644 (file)
@@ -46,15 +46,6 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Prevents from showing child widgets in AT-SPI tree.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override bool AccessibilityShouldReportZeroChildren()
-        {
-            return true;
-        }
-
-        /// <summary>
         /// The ButtonExtension instance that is injected by ButtonStyle.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -71,7 +62,7 @@ namespace Tizen.NUI.Components
             {
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
-                AccessibilityHighlightable = false,
+                AccessibilityHidden = true,
             };
         }
 
@@ -84,7 +75,7 @@ namespace Tizen.NUI.Components
         {
             return new ImageView()
             {
-                AccessibilityHighlightable = false
+                AccessibilityHidden = true,
             };
         }
 
@@ -102,7 +93,7 @@ namespace Tizen.NUI.Components
                 PivotPoint = NUI.PivotPoint.Center,
                 WidthResizePolicy = ResizePolicyType.FillToParent,
                 HeightResizePolicy = ResizePolicyType.FillToParent,
-                AccessibilityHighlightable = false
+                AccessibilityHidden = true,
             };
         }
 
index fe619b6..9b0e332 100755 (executable)
@@ -512,15 +512,6 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Prevents from showing child widgets in AT-SPI tree.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override bool AccessibilityShouldReportZeroChildren()
-        {
-            return true;
-        }
-
-        /// <summary>
         /// Gets minimum value for Accessibility.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
@@ -685,7 +676,7 @@ namespace Tizen.NUI.Components
                 {
                     indeterminateAnimation = new Animation(2000);
                 }
-                
+
                 float destination = (this.SizeWidth - indeterminateImage.SizeWidth);
 
                 KeyFrames keyFrames = new KeyFrames();
@@ -796,7 +787,8 @@ namespace Tizen.NUI.Components
                     HeightResizePolicy = ResizePolicyType.FillToParent,
                     PositionUsesPivotPoint = true,
                     ParentOrigin = NUI.ParentOrigin.TopLeft,
-                    PivotPoint = NUI.PivotPoint.TopLeft
+                    PivotPoint = NUI.PivotPoint.TopLeft,
+                    AccessibilityHidden = true,
                 };
                 Add(trackImage);
             }
@@ -812,7 +804,8 @@ namespace Tizen.NUI.Components
                     HeightResizePolicy = ResizePolicyType.FillToParent,
                     PositionUsesPivotPoint = true,
                     ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
-                    PivotPoint = Tizen.NUI.PivotPoint.TopLeft
+                    PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+                    AccessibilityHidden = true,
                 };
                 Add(progressImage);
             }
@@ -828,7 +821,8 @@ namespace Tizen.NUI.Components
                     HeightResizePolicy = ResizePolicyType.FillToParent,
                     PositionUsesPivotPoint = true,
                     ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
-                    PivotPoint = Tizen.NUI.PivotPoint.TopLeft
+                    PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+                    AccessibilityHidden = true,
                 };
                 Add(bufferImage);
                 bufferImage.Hide(); // At first, buffer image does not show.
@@ -842,7 +836,8 @@ namespace Tizen.NUI.Components
                 Size = new Size(16, 16),
                 PositionUsesPivotPoint = true,
                 ParentOrigin = Tizen.NUI.ParentOrigin.CenterLeft,
-                PivotPoint = Tizen.NUI.PivotPoint.CenterLeft
+                PivotPoint = Tizen.NUI.PivotPoint.CenterLeft,
+                AccessibilityHidden = true,
             };
             trackImage.Add(indeterminateImage);
             indeterminateImage.Hide();
index 8c33d23..f6a20ac 100755 (executable)
@@ -126,7 +126,8 @@ namespace Tizen.NUI.Components
                 slidedTrackImage = new ImageView()
                 {
                     WidthResizePolicy = ResizePolicyType.Fixed,
-                    HeightResizePolicy = ResizePolicyType.Fixed
+                    HeightResizePolicy = ResizePolicyType.Fixed,
+                    AccessibilityHidden = true,
                 };
 
                 if (bgTrackImage != null)
@@ -145,7 +146,8 @@ namespace Tizen.NUI.Components
                 warningTrackImage = new ImageView()
                 {
                     WidthResizePolicy = ResizePolicyType.Fixed,
-                    HeightResizePolicy = ResizePolicyType.Fixed
+                    HeightResizePolicy = ResizePolicyType.Fixed,
+                    AccessibilityHidden = true,
                 };
 
                 if (bgTrackImage != null)
@@ -174,7 +176,8 @@ namespace Tizen.NUI.Components
                 warningSlidedTrackImage = new ImageView()
                 {
                     WidthResizePolicy = ResizePolicyType.Fixed,
-                    HeightResizePolicy = ResizePolicyType.Fixed
+                    HeightResizePolicy = ResizePolicyType.Fixed,
+                    AccessibilityHidden = true,
                 };
 
                 if (warningTrackImage != null)
@@ -193,7 +196,8 @@ namespace Tizen.NUI.Components
                 lowIndicatorText = new TextLabel()
                 {
                     WidthResizePolicy = ResizePolicyType.Fixed,
-                    HeightResizePolicy = ResizePolicyType.Fixed
+                    HeightResizePolicy = ResizePolicyType.Fixed,
+                    AccessibilityHidden = true,
                 };
                 this.Add(lowIndicatorText);
             }
@@ -208,7 +212,8 @@ namespace Tizen.NUI.Components
                 highIndicatorText = new TextLabel()
                 {
                     WidthResizePolicy = ResizePolicyType.Fixed,
-                    HeightResizePolicy = ResizePolicyType.Fixed
+                    HeightResizePolicy = ResizePolicyType.Fixed,
+                    AccessibilityHidden = true,
                 };
                 this.Add(highIndicatorText);
             }
@@ -226,7 +231,8 @@ namespace Tizen.NUI.Components
                     HeightResizePolicy = ResizePolicyType.Fixed,
                     ParentOrigin = Tizen.NUI.ParentOrigin.Center,
                     PivotPoint = Tizen.NUI.PivotPoint.Center,
-                    PositionUsesPivotPoint = true
+                    PositionUsesPivotPoint = true,
+                    AccessibilityHidden = true,
                 };
                 this.Add(bgTrackImage);
 
@@ -259,7 +265,8 @@ namespace Tizen.NUI.Components
                     ParentOrigin = NUI.ParentOrigin.Center,
                     PivotPoint = NUI.PivotPoint.Center,
                     PositionUsesPivotPoint = true,
-                    EnableControlState = true
+                    EnableControlState = true,
+                    AccessibilityHidden = true,
                 };
                 if (bgTrackImage != null)
                 {
@@ -283,6 +290,7 @@ namespace Tizen.NUI.Components
                     PivotPoint = Tizen.NUI.PivotPoint.Center,
                     WidthResizePolicy = ResizePolicyType.Fixed,
                     HeightResizePolicy = ResizePolicyType.Fixed,
+                    AccessibilityHidden = true,
                 };
                 if (valueIndicatorText != null)
                 {
@@ -303,7 +311,8 @@ namespace Tizen.NUI.Components
                 valueIndicatorText = new TextLabel()
                 {
                     WidthResizePolicy = ResizePolicyType.Fixed,
-                    HeightResizePolicy = ResizePolicyType.Fixed
+                    HeightResizePolicy = ResizePolicyType.Fixed,
+                    AccessibilityHidden = true,
                 };
                 if (valueIndicatorImage != null)
                 {
index d428b21..cafe78f 100755 (executable)
@@ -913,7 +913,14 @@ namespace Tizen.NUI.Components
             }
             set
             {
-                if (null == lowIndicatorImage) lowIndicatorImage = new ImageView();
+                if (null == lowIndicatorImage)
+                {
+                    lowIndicatorImage = new ImageView
+                    {
+                        AccessibilityHidden = true,
+                    };
+                }
+
                 lowIndicatorImage.ResourceUrl = value;
             }
         }
@@ -942,7 +949,14 @@ namespace Tizen.NUI.Components
             }
             set
             {
-                if (null == highIndicatorImage) highIndicatorImage = new ImageView();
+                if (null == highIndicatorImage)
+                {
+                    highIndicatorImage = new ImageView
+                    {
+                        AccessibilityHidden = true,
+                    };
+                }
+
                 highIndicatorImage.ResourceUrl = value;
             }
         }
@@ -1415,6 +1429,7 @@ namespace Tizen.NUI.Components
                         BorderlineWidth = 6.0f,
                         BorderlineOffset = -1f,
                         BackgroundColor = new Color(0.2f, 0.2f, 0.2f, 0.4f),
+                        AccessibilityHidden = true,
                     };
                 }
                 recoverIndicator = FocusManager.Instance.FocusIndicator;
@@ -1552,15 +1567,6 @@ namespace Tizen.NUI.Components
         }
 
         /// <summary>
-        /// Prevents from showing child widgets in AT-SPI tree.
-        /// </summary>
-        [EditorBrowsable(EditorBrowsableState.Never)]
-        protected override bool AccessibilityShouldReportZeroChildren()
-        {
-            return true;
-        }
-
-        /// <summary>
         /// Gets minimum value for Accessibility.
         /// </summary>
         [EditorBrowsable(EditorBrowsableState.Never)]
index a8811a7..1879c7d 100755 (executable)
@@ -239,9 +239,9 @@ namespace Tizen.NUI
                 public AccessibilityGetActionName GetActionName; // 6
 
                 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-                public delegate bool AccessibilityShouldReportZeroChildren(IntPtr self);
+                public delegate uint AccessibilityGetInterfaces(IntPtr self);
                 [EditorBrowsable(EditorBrowsableState.Never)]
-                public AccessibilityShouldReportZeroChildren ShouldReportZeroChildren; // 7
+                public AccessibilityGetInterfaces GetInterfaces; // 7
 
                 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
                 public delegate double AccessibilityGetMinimum(IntPtr self);
@@ -384,14 +384,9 @@ namespace Tizen.NUI
                 public AccessibilityDeselectChild DeselectChild; // 35
 
                 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
-                public delegate uint AccessibilityGetInterfaces(IntPtr self);
-                [EditorBrowsable(EditorBrowsableState.Never)]
-                public AccessibilityGetInterfaces GetInterfaces; // 36
-
-                [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
                 public delegate IntPtr AccessibilityGetRangeExtents(IntPtr self, int startOffset, int endOffset, int coordType);
                 [EditorBrowsable(EditorBrowsableState.Never)]
-                public AccessibilityGetRangeExtents GetRangeExtents; // 37
+                public AccessibilityGetRangeExtents GetRangeExtents; // 36
             }
 
             [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_DuplicateString")]
index 7ad8da8..461c496 100755 (executable)
@@ -490,12 +490,6 @@ namespace Tizen.NUI.BaseComponents
         }
 
         [EditorBrowsable(EditorBrowsableState.Never)]
-        protected virtual bool AccessibilityShouldReportZeroChildren()
-        {
-            return false;
-        }
-
-        [EditorBrowsable(EditorBrowsableState.Never)]
         protected virtual bool AccessibilityIsScrollable()
         {
             return false;
index d83ffde..30f2da4 100644 (file)
@@ -416,7 +416,6 @@ namespace Tizen.NUI.BaseComponents
             var ad = Interop.ControlDevel.AccessibilityDelegate.Instance;
 
             ad.ScrollToChild            = AccessibilityScrollToChildWrapper;
-            ad.ShouldReportZeroChildren = AccessibilityShouldReportZeroChildrenWrapper;
         }
 
         private static bool AccessibilityScrollToChildWrapper(IntPtr self, IntPtr child)
@@ -425,10 +424,5 @@ namespace Tizen.NUI.BaseComponents
 
             return view.AccessibilityScrollToChild(view.GetInstanceSafely<View>(child));
         }
-
-        private static bool AccessibilityShouldReportZeroChildrenWrapper(IntPtr self)
-        {
-            return GetViewFromRefObject(self).AccessibilityShouldReportZeroChildren();
-        }
     }
 }