Can't use Ctrl+tab on iOS / Ctrl + tab doesn’t cycle to next tab

Platform

iOS
Android

Obsidian Mobile version: v1.4.1
iPadOS: 16.1


Expecting ctrl + tab to cycle through tabs, but nothing happens. If I look up the command, it says the hotkey is bound to it, but pressing ctrl + tab doesn’t get any response.

3 Likes

Bumping this up because it is still an issue on Obsidian mobile version 1.4.6

1 Like

Continuing to bump this up as there hasn’t been any solution as far as I can tell

Isn’t it cmd tab on iOS/macos?

What exactly are you trying to do? Post a screen recording

Trying to help here…

The user is saying in this BR is that the on Obsidian Mobile on iPadOS (using an external keyboard) we CAN’T assign a command to the combination of keys CRTL + TAB the same way that we CAN on Obsidian Desktop.

Moreover, any command previously assigned to CRTL + TAB on Obsidian Desktop DOES NOT work when hitting CRTL + TAB on Obsidian Mobile on iPadOS (using an external keyboard).

In other words, CRTL + TAB does not work on Obsidian Mobile on iPadOS the same way that works on Obsidian Desktop.

On iPadOS, CMD + TAB is a native iPadOS command used to cycle between apps. This BR is about CRTL + TAB and NOT about CMD + TAB

I hope it helps you to understand the issue :pray:

1 Like

Ok, now I understand. if you assign the tab switching to something else. Does it work?

YES. If you assign the command Go to Next Tab to a different hotkey like CTRL+4 it works PERFECT on Obsidian Mobile on iPadOS with an external keyboard.

Another information that I investigate before writing this reply… if you emulate Obsidian Mobile on Desktop you are NOT ABLE to see the issue.

In other words to see this happening on Obsidian Mobile, I have to use an iPad with iPadOS and an external keyboard to reproduce the issue on your end.

I hope it helps :pray:

Thank you yes, this is exactly the problem. On MacOS ctrl tab cycles through the tabs, but on iPad it does not.

Assigning a different hotkey works—but that becomes very strange to have to use two different hotkeys on iPad vs Mac. Also ctrl tab is generally the default hotkey for cycling between tabs in all other apps.

1 Like

This is still a problem with Obsidian 1.7.4 on iPadOS 18.1. Inside the JS console, I see that Ctrl-Tab and Ctrl-Shift-Tab are not propagated into the web view.

From the docs it appears that you need to register a native UICommand with wantsPriorityOverSystemBehavior set to true, otherwise the default focus-switching behavior of iPadOS takes precedence. Brave fixed this in this commit (PR).

I recently started using Obsidian on my iPad with Magic Keyboard and this issue is really affecting my productivity.

1 Like

Hi, I’m a bit new here and have the same issue. Is this solution something that I can fix within my app, or is it on the Obsidian developers to add this functionality to the app? Thanks!

Hi, it’s been months and I’m taking matters into my own hands. I extracted the HTML/JS into my own Capacitor project, and did the fix myself[1]. This is how the team can implement it:

  1. Create a custom ViewController by following official Capacitor docs
  2. After the last step, replace the code with the following (replace ObsidianViewController with whatever you named yours)
import UIKit
import Capacitor

class ObsidianViewController: CAPBridgeViewController {
	override var keyCommands: [UIKeyCommand]? {
		let tabNavigationCommands = [
			UIKeyCommand(
				input: "\t",
				modifierFlags: .control,
				action: #selector(handleCtrlTab)
			),
			UIKeyCommand(
				input: "\t",
				modifierFlags: [.control, .shift],
				action: #selector(handleCtrlShiftTab)
			),
			UIKeyCommand(
				input: "w",
				modifierFlags: .command,
				action: #selector(handleCmdW)
			)
		];

		if #available(iOS 15.0, *) {
			tabNavigationCommands.forEach { $0.wantsPriorityOverSystemBehavior = true }
		}
	
		return tabNavigationCommands
	}
	
	@objc private func handleCtrlTab() {
		print("Ctrl-Tab pressed")
		let eventData = """
			{
				key: "Tab",
				code: "Tab",
				keyCode: 9,
				ctrlKey: true,
			}
		""";
		bridge?.triggerDocumentJSEvent(eventName:"keydown", data:eventData)
	}
	
	@objc private func handleCtrlShiftTab() {
		print("Ctrl-Shift-Tab pressed")
		let eventData = """
			{
				key: "Tab",
				code: "Tab",
				keyCode: 9,
				ctrlKey: true,
				shiftKey: true,
			}
		""";
		bridge?.triggerDocumentJSEvent(eventName:"keydown", data:eventData)
	}
	
	@objc private func handleCmdW() {
		print("Cmd-W pressed")
		let eventData = """
			{
				key: "w",
				code: "KeyW",
				keyCode: 87,
				metaKey: true,
			}
		""";
		bridge?.triggerDocumentJSEvent(eventName:"keydown", data:eventData)
	}
}

I have tested this on my M4 iPad Pro with iPadOS 18.3. To test this in the simulator, enable I/O > Input > Send Keyboard Input to Device so those special keys can be captured:

@WhiteNoise Can this somehow be prioritized? I listed out the instructions and provided working code above, so this shouldn’t take much of the team’s time. :pray:


  1. Had to stub startWatch in the Filesystem plugin - I assume this is some downstream Obsidian addition ↩︎