[PR #6343] Allow starting selections from padding area #26656

Open
opened 2026-01-31 09:17:23 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/6343

State: closed
Merged: Yes


WinUI's Margin and Padding work very similarly. Margin distances
ourselves from our parent. Whereas Padding distances our children from
ourselves.

Terminal's padding setting is actually implemented by defining
Margin on the SwapChainPanel. This means that the "padding" that is
created is actually belongs to SwapChainPanel's parent: Grid (not to be
confused with its parent, "RootGrid").

When a user clicks on the padded area, input goes to Grid. But there's a
twist: you can't actually hit Grid. To be able to hit Grid, you can't
just set IsHitTestVisible. You need to set it's Visibility to Visible,
and it's Background to Transparent (not null) [2].

Validation Steps Performed

  • Start a selection from the padding area
  • Click on a SearchBox if one is available
    • The SearchBox gets first dibs on the hit test so none gets through
      to the SwapChainPanel

References

[1] https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.uielement.ishittestvisible
[2] https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/events-and-routed-events-overview#hit-testing-and-input-events

Closes #5626

**Original Pull Request:** https://github.com/microsoft/terminal/pull/6343 **State:** closed **Merged:** Yes --- WinUI's `Margin` and `Padding` work very similarly. `Margin` distances ourselves from our parent. Whereas `Padding` distances our children from ourselves. Terminal's `padding` setting is actually implemented by defining `Margin` on the SwapChainPanel. This means that the "padding" that is created is actually belongs to SwapChainPanel's parent: Grid (not to be confused with its parent, "RootGrid"). When a user clicks on the padded area, input goes to Grid. But there's a twist: you can't actually hit Grid. To be able to hit Grid, you can't just set IsHitTestVisible. You need to set it's Visibility to Visible, and it's Background to Transparent (not null) [2]. ## Validation Steps Performed - [X] Start a selection from the padding area - [X] Click on a SearchBox if one is available - The SearchBox gets first dibs on the hit test so none gets through to the SwapChainPanel ## References [1] https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.uielement.ishittestvisible [2] https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/events-and-routed-events-overview#hit-testing-and-input-events Closes #5626
claunia added the pull-request label 2026-01-31 09:17:23 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26656