From d4a9e7ca472280dc75112561a433982ebea8d8f7 Mon Sep 17 00:00:00 2001 From: Maria Bialota Date: Fri, 19 Apr 2024 16:15:10 +0200 Subject: [PATCH] [NUI][AT-SPI] Fixed Dialog and AlertDialog behaviour --- src/Tizen.NUI.Components/Controls/AlertDialog.cs | 26 ++++++++++++++++++++++-- src/Tizen.NUI.Components/Controls/Dialog.cs | 16 ++++++++++++++- 2 files changed, 39 insertions(+), 3 deletions(-) mode change 100755 => 100644 src/Tizen.NUI.Components/Controls/AlertDialog.cs diff --git a/src/Tizen.NUI.Components/Controls/AlertDialog.cs b/src/Tizen.NUI.Components/Controls/AlertDialog.cs old mode 100755 new mode 100644 index 5a4334d..ffe2ca6 --- a/src/Tizen.NUI.Components/Controls/AlertDialog.cs +++ b/src/Tizen.NUI.Components/Controls/AlertDialog.cs @@ -79,6 +79,9 @@ namespace Tizen.NUI.Components return; } + AddedToWindow -= OnAddedToWindow; + RemovedFromWindow -= OnRemovedFromWindow; + if (type == DisposeTypes.Explicit) { if (titleContent != null) @@ -474,7 +477,14 @@ namespace Tizen.NUI.Components [EditorBrowsable(EditorBrowsableState.Never)] protected override string AccessibilityGetDescription() { - return Message; + if (!String.IsNullOrEmpty(Title)) + { + return Message; + } + else + { + return ""; + } } /// @@ -485,9 +495,19 @@ namespace Tizen.NUI.Components { base.OnInitialize(); AccessibilityRole = Role.Dialog; + } + + private void OnAddedToWindow(object sender, EventArgs e) + { Show(); // calls RegisterDefaultLabel(); Hide() will call UnregisterDefaultLabel() } + private void OnRemovedFromWindow(object sender, EventArgs e) + { + Hide(); + } + + /// /// Informs AT-SPI bridge about the set of AT-SPI states associated with this object. /// @@ -571,7 +591,9 @@ namespace Tizen.NUI.Components linearLayout.CellPadding = new Size2D(alertDialogStyle.ItemSpacing.Width, alertDialogStyle.ItemSpacing.Height); } - this.Relayout += OnRelayout; + Relayout += OnRelayout; + AddedToWindow += OnAddedToWindow; + RemovedFromWindow += OnRemovedFromWindow; TitleContent = DefaultTitleContent; diff --git a/src/Tizen.NUI.Components/Controls/Dialog.cs b/src/Tizen.NUI.Components/Controls/Dialog.cs index 3bf4ee9..8c69f07 100755 --- a/src/Tizen.NUI.Components/Controls/Dialog.cs +++ b/src/Tizen.NUI.Components/Controls/Dialog.cs @@ -52,7 +52,9 @@ namespace Tizen.NUI.Components { Layout = new AbsoluteLayout(); - this.Relayout += OnRelayout; + Relayout += OnRelayout; + AddedToWindow += OnAddedToWindow; + RemovedFromWindow += OnRemovedFromWindow; } /// @@ -93,6 +95,9 @@ namespace Tizen.NUI.Components return; } + AddedToWindow -= OnAddedToWindow; + RemovedFromWindow -= OnRemovedFromWindow; + if (type == DisposeTypes.Explicit) { this.Relayout -= OnRelayout; @@ -159,9 +164,18 @@ namespace Tizen.NUI.Components { base.OnInitialize(); AccessibilityRole = Role.Dialog; + } + + private void OnAddedToWindow(object sender, EventArgs e) + { Show(); // calls RegisterDefaultLabel(); Hide() will call UnregisterDefaultLabel() } + private void OnRemovedFromWindow(object sender, EventArgs e) + { + Hide(); + } + /// /// Informs AT-SPI bridge about the set of AT-SPI states associated with this object. /// -- 2.7.4