Description
- Open Terminal
- On a touch device, start Narrator
- Hover over title bar content such as min/max/close buttons
- Observe that Narrator cannot find the controls
- Alternative, use Inspect and use it to hit test the title bar content
- Observe that hit testing in Inspect doesn't find the min/max/close controls
It is worth noting that the tabs in the title bar hit test correctly. The draggable part also hit tests, but Inspect shows that the bounding rect extends beyond the bounds of the window (looks like the width is that of the window rather than (window - tabs)).
Notes from original reporter
This issue was discovered in the investigation of a similar issue in File Explorer. We believe it is up to providers
to support hit testing when their client area extends into the title bar.In this scenario, the issue is that the app has specified that its client area includes the non-client area of the
title bar. UIA makes sure not to override any hit testing that is within the client area of an app.To make this work, we recommend following the pattern of other apps that extend their client area into the title bar,
such as WordPad:
- Set the provider option to remove UIA non-client area support (may be more of an optimization and not strictly
required) by returning ProviderOptions_RefuseNonClientSupport.ex:
CUxHWNDElementProvider::get_ProviderOptions { // <snip> // Claim support for the non-client area *pRetVal = (ProviderOptions)(ProviderOptions_ServerSideProvider | ProviderOptions_RefuseNonClientSupport); return S_OK; }
- Update client-area hit testing to also test non-client controls, such as min/max/close buttons.
ex:
CUxHWNDElementProvider::RootElementProviderFromPoint // <snip> // Ask the main frame what caption element pt is on, if any POINT pt = {static_cast<LONG>(x), static_cast<LONG>(y)}; LRESULT lHit = SendMessage(_hwndMain, WM_NCHITTEST, 0, POINTTOPOINTS(pt)); // Special case for custom caption elements: this could potentially be a custom child element // Those values are returned by HWndContainer::OnNcHitTest if (lHit == HTCAPTION || lHit == HTBORDER) { // <snip> --- Special handling for custom controls in title bar --- } // If we don't have anything yet, try the regular hit-testing for non-client. if (pProvider == NULL) { // <snip> --- maps lHit to OBJID_* --- // Get the non-client provider for this piece and wrap it up IRawElementProviderSimple * pRawProvider; hr = UiaProviderForNonClient(_hwndMain, lEnd, CHILDID_SELF, &pRawProvider); ...
Ported from MSFT-38927143