Users cannot Touch Inspect window caption controls #18066

Open
opened 2026-01-31 06:02:45 +00:00 by claunia · 2 comments
Owner

Originally created by @DHowett on GitHub (Jul 29, 2022).

  1. Open Terminal
  2. On a touch device, start Narrator
    1. Hover over title bar content such as min/max/close buttons
    2. Observe that Narrator cannot find the controls
  3. Alternative, use Inspect and use it to hit test the title bar content
    1. 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:

  1. 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;  
}  
  1. 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

Originally created by @DHowett on GitHub (Jul 29, 2022). 1. Open Terminal 1. On a touch device, start Narrator 1. Hover over title bar content such as min/max/close buttons 1. Observe that Narrator cannot find the controls 1. Alternative, use Inspect and use it to hit test the title bar content 1. 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: > > 1) 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: > > ```c++ > CUxHWNDElementProvider::get_ProviderOptions > { > // <snip> > // Claim support for the non-client area > *pRetVal = (ProviderOptions)(ProviderOptions_ServerSideProvider | ProviderOptions_RefuseNonClientSupport); > return S_OK; > } > ``` > > 2) Update client-area hit testing to also test non-client controls, such as min/max/close buttons. > > ex: > > ```c++ > 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_
claunia added the Issue-BugProduct-TerminalPriority-2Area-Accessibility labels 2026-01-31 06:02:46 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Aug 1, 2022):

Hey we may need to do this for theming! There's a mail thread titled "RE: Snap Flyouts only over DWM caption buttons?". See also #10509

@zadjii-msft commented on GitHub (Aug 1, 2022): Hey we may need to do this for theming! There's a mail thread titled "RE: Snap Flyouts only over DWM caption buttons?". See also #10509
Author
Owner

@zadjii-msft commented on GitHub (Aug 2, 2022):

Maybe also related: #11260

@zadjii-msft commented on GitHub (Aug 2, 2022): Maybe also related: #11260
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18066