<!--
{
  "availability" : [
    "iOS: 18.4.0 -",
    "iPadOS: 18.4.0 -",
    "macCatalyst: -",
    "macOS: 15.4.0 -",
    "visionOS: 2.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKWebExtensionContext/didMoveTab(_:from:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "s:So21WKWebExtensionContextC6WebKitE10didMoveTab_4from2inySo0abH0_p_SiSo0aB6Window_pSgtF"
  },
  "title" : "didMoveTab(_:from:in:)"
}
-->

# didMoveTab(_:from:in:)

Called by the app when a tab is moved to fire appropriate events with only this extension.

```
@MainActor @preconcurrency func didMoveTab(_ movedTab: any WKWebExtensionTab, from index: Int, in oldWindow: (any WKWebExtensionWindow)? = nil)
```

## Parameters

`movedTab`

The tab that was moved.

`index`

The old index of the tab within the window.

`oldWindow`

The window that the tab was moved from, or `nil` if the tab isn’t moving from an open window.

## Discussion

If the window is staying the same, the current window should be specified. This method informs only the specific extension that a tab has been moved. If the intention is to inform all loaded extensions consistently, you should use the respective method on the extension controller instead.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)