Repository: microsoft/terminal (language: cpp)

Issue:
[Window Terimal Preview - Tearout tab] : User is not able to perform the 'Tearout', 'Transfer' tab functionality using keyboard.
### Windows Terminal version

1.18.902.0

### Windows build number

25324.1011

### Other Software

**Test Environment:** 
OS: Windows 11 Version Dev (OS Build 25324.1011)
App: Windows Terminal Preview
Screen Reader: Narrator

### Steps to reproduce

Repro Steps:

1.Open Windows Terminal.
2.Open multiple 'Command prompt' using 'Ctrl + Shift + 1' keys.
3.Now try to perform 'Tearout' and 'Transfer' tab functionality using keyboard.
4.Observe the issue.

Users Experience:
Users who rely on keyboard will get impacted here & fail to use the functionality effectively.

Guideline link:
https://www.w3.org/TR/WCAG21/#keyboard

Attachments:
[User is not able to perform the 'Tearout', 'Transfer' tab functionality using keyboard..zip](https://github.com/microsoft/terminal/files/11197147/User.is.not.able.to.perform.the.Tearout.Transfer.tab.functionality.using.keyboard.zip)




### Expected Behavior

User should be able to perform the 'Tearout', 'Transfer' tab functionality using keyboard.
> Even shortcut should be defined to perform 'Tearout', 'Transfer' tab- functionality.

### Actual Behavior

User is not able to perform the 'Tearout', 'Transfer' tab functionality using keyboard.
> Even no shortcut is defined for 'Tearout', 'Transfer' tab- functionality


Discussion / hints:
@Saiteja341 The user is free to define actions like:

```jsonc

        { "keys": "f1", "command": { "action": "moveTab", "window": "1" }, },
        { "keys": "f2", "command": { "action": "moveTab", "window": "2" }, },
        { "keys": "f3", "command": { "action": "movePane", "window": "1" }, },
        { "keys": "f4", "command": { "action": "movePane", "window": "2" }, },
```

in their settings, which would allow them to move tabs / panes to other windows using just the keyboard. Is that sufficient?
Hi @zadjii-msft ,

Thanks for providing these command but what if a user doesn't know about these commands, they will not able to perform this functionality.

It should be either pre-define in the terminal's action, So that user might we able to use this functionality with keyboard shortcuts.
@Saiteja341 Would a default action for "move this tab/pane to a new window" be sufficient here? It should be fairly trivial for us to add a pair of 

```
        { "command": { "action": "moveTab", "window": "new" }, },
        { "command": { "action": "movePane", "window": "new" }, },
```

default actions, and have them just work out of the box. 
@Saiteja341 gentle ping ☺️ Would a default action for "move this tab/pane to a new window" be sufficient here?

Fix patch:
diff --git a/src/cascadia/TerminalSettingsModel/ActionArgs.cpp b/src/cascadia/TerminalSettingsModel/ActionArgs.cpp
index 626817b0366..67d7493e2f7 100644
--- a/src/cascadia/TerminalSettingsModel/ActionArgs.cpp
+++ b/src/cascadia/TerminalSettingsModel/ActionArgs.cpp
@@ -249,6 +249,13 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
     {
         if (!Window().empty())
         {
+            // Special case for moving to a new window. We can just ignore the
+            // tab index, because it _doesn't matter_. There won't be any tabs
+            // in the new window, till we get there.
+            if (Window() == L"new")
+            {
+                return RS_(L"MovePaneToNewWindowCommandKey");
+            }
             return winrt::hstring{
                 fmt::format(L"{}, window:{}, tab index:{}", RS_(L"MovePaneCommandKey"), Window(), TabIndex())
             };
@@ -658,6 +665,10 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
     {
         if (!Window().empty())
         {
+            if (Window() == L"new")
+            {
+                return RS_(L"MoveTabToNewWindowCommandKey");
+            }
             return winrt::hstring{
                 fmt::format(std::wstring_view(RS_(L"MoveTabToWindowCommandKey")),
                             Window())
diff --git a/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw b/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw
index 1d6502c1f7a..0b6fced889b 100644
--- a/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw
+++ b/src/cascadia/TerminalSettingsModel/Resources/en-US/Resources.resw
@@ -174,6 +174,9 @@
     <value>Move tab to window "{0}"</value>
     <comment>{0} will be replaced with a user-specified name of a window</comment>
   </data>
+  <data name="MoveTabToNewWindowCommandKey" xml:space="preserve">
+    <value>Move tab to a new window</value>
+  </data>
   <data name="MoveTabDirectionForward" xml:space="preserve">
     <value>forward</value>
   </data>
@@ -422,6 +425,9 @@
   <data name="MovePaneCommandKey" xml:space="preserve">
     <value>Move pane</value>
   </data>
+  <data name="MovePaneToNewWindowCommandKey" xml:space="preserve">
+    <value>Move pane to new window</value>
+  </data>
   <data name="SplitPaneCommandKey" xml:space="preserve">
     <value>Split pane</value>
   </data>
diff --git a/src/cascadia/TerminalSettingsModel/defaults.json b/src/cascadia/TerminalSettingsModel/defaults.json
index daf9827edf3..c67187e4528 100644
--- a/src/cascadia/TerminalSettingsModel/defaults.json
+++ b/src/cascadia/TerminalSettingsModel/defaults.json
@@ -405,6 +405,7 @@
         { "command": { "action": "switchToTab", "index": 6 }, "keys": "ctrl+alt+7" },
         { "command": { "action": "switchToTab", "index": 7 }, "keys": "ctrl+alt+8" },
         { "command": { "action": "switchToTab", "index": 4294967295 }, "keys": "ctrl+alt+9" },
+        { "command": { "action": "moveTab", "window": "new" }, },
 
         // Pane Management
         { "command": "closeOtherPanes" },
@@ -449,6 +450,7 @@
         { "command": { "action": "movePane", "index": 6 } },
         { "command": { "action": "movePane", "index": 7 } },
         { "command": { "action": "movePane", "index": 8 } },
+        { "command": { "action": "movePane", "window": "new" }, },
         { "command": "restartConnection" },
 
         // Clipboard Integration


Test patch: