From 3914bb746bc589f72ecc0e764a0fe35132a8896e Mon Sep 17 00:00:00 2001 From: Vladimir Krestov Date: Tue, 15 Oct 2019 18:32:11 +0300 Subject: [PATCH] Added tooltip text announcing by ScreenReader --- .../src/System/Windows/Forms/ToolTip.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip.cs b/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip.cs index 77263c1ae43..283c9ad5909 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/ToolTip.cs @@ -621,6 +621,17 @@ private void AdjustBaseFromAuto() _delayTimes[(int)ComCtl32.TTDT.INITIAL] = _delayTimes[(int)ComCtl32.TTDT.AUTOMATIC]; } + /// + /// ScreenReader announces ToolTip text for an element + /// + private void AnnounceText(Control tool, string text) + { + tool?.AccessibilityObject?.RaiseAutomationNotification( + Automation.AutomationNotificationKind.ActionCompleted, + Automation.AutomationNotificationProcessing.All, + ToolTipTitle + " " + text); + } + private void HandleCreated(object sender, EventArgs eventargs) { // Reset the toplevel control when the owner's handle is recreated. @@ -2068,6 +2079,11 @@ private void WmShow() e.Cancel = true; } + if (!e.Cancel) + { + AnnounceText(toolControl, GetCaptionForTool(toolControl)); + } + // We need to re-get the rectangle of the tooltip here because // any of the tooltip attributes/properties could have been updated // during the popup event; in which case the size of the tooltip is