microsoft / microsoft/terminal
Users cannot Touch Inspect window caption controls
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
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
> {
> //
> // 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
> //
> // Ask the main frame what caption element pt is on, if any
> POINT pt = {static_cast(x), static_cast(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)
> {
> // --- 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)
> {
> // --- 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_
Contributor guide
Research direction
Start by locating CUxHWNDElementProvider::get_ProviderOptions and RootElementProviderFromPoint, then reproduce the title-bar behavior with Narrator or Inspect on a touch device. Compare the provider's handling with the documented WordPad pattern and verify that min/max/close controls are discoverable while tabs and the draggable area still hit test correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- accessibility, desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100