fix: make navigation no-focus by default
- Change nav open and open-wait to avoid activating newly created tabs unless --focus is explicitly requested. - Send background=true for default opens so older or remote extensions also avoid stealing focus even if they ignore the new focus flag. - Remove the redundant --bg flag from navigation and search CLI commands now that no-focus/background behavior is the default. - Thread focus support through the sync SDK, async SDK, tab helpers, and workflow decorators. - Update README and demo usage to document the new default and --focus opt-in. - Bump package and extension metadata to 0.12.3. - Add regression coverage for CLI help, wire payloads, and extension behavior.
This commit is contained in:
+9
-5
@@ -160,7 +160,7 @@ class TestNavigation:
|
||||
b.nav.open("https://example.com")
|
||||
mock_send.assert_called_once_with(
|
||||
"navigate.open",
|
||||
{"url": "https://example.com", "background": False, "window": None, "group": None},
|
||||
{"url": "https://example.com", "background": True, "focus": False, "window": None, "group": None},
|
||||
profile=None, remote=None, key=None,
|
||||
)
|
||||
|
||||
@@ -173,6 +173,10 @@ class TestNavigation:
|
||||
b.nav.open("https://x.com", group="Work")
|
||||
assert mock_send.call_args[0][1]["group"] == "Work"
|
||||
|
||||
def test_open_focus_is_explicit(self, b, mock_send):
|
||||
b.nav.open("https://example.com", focus=True)
|
||||
assert mock_send.call_args[0][1]["focus"] is True
|
||||
|
||||
def test_tabs_open_returns_bound_tab(self, b, mock_send):
|
||||
mock_send.return_value = {"id": 123, "url": "https://example.com"}
|
||||
|
||||
@@ -183,7 +187,7 @@ class TestNavigation:
|
||||
assert tab._browser is b
|
||||
mock_send.assert_called_once_with(
|
||||
"navigate.open",
|
||||
{"url": "https://example.com", "background": True, "window": None, "group": None},
|
||||
{"url": "https://example.com", "background": True, "focus": False, "window": None, "group": None},
|
||||
profile=None,
|
||||
remote=None,
|
||||
key=None,
|
||||
@@ -197,7 +201,7 @@ class TestNavigation:
|
||||
assert tab.id == 10
|
||||
mock_send.assert_called_once_with(
|
||||
"navigate.open_wait",
|
||||
{"url": "https://example.com", "timeout": 1500, "background": False, "window": None, "group": None},
|
||||
{"url": "https://example.com", "timeout": 1500, "background": True, "focus": False, "window": None, "group": None},
|
||||
profile=None,
|
||||
remote=None,
|
||||
key=None,
|
||||
@@ -1031,7 +1035,7 @@ class TestSDKDecorators:
|
||||
assert mock_send.mock_calls == [
|
||||
call(
|
||||
"navigate.open_wait",
|
||||
{"url": "https://example.com", "timeout": 1500, "background": False, "window": None, "group": None},
|
||||
{"url": "https://example.com", "timeout": 1500, "background": True, "focus": False, "window": None, "group": None},
|
||||
profile=None,
|
||||
remote=None,
|
||||
key=None,
|
||||
@@ -1190,7 +1194,7 @@ class TestAsyncBrowserCLI:
|
||||
assert mock_send_async.mock_calls == [
|
||||
call(
|
||||
"navigate.open",
|
||||
{"url": "https://example.com", "background": False, "window": None, "group": None},
|
||||
{"url": "https://example.com", "background": True, "focus": False, "window": None, "group": None},
|
||||
profile=None,
|
||||
remote=None,
|
||||
key=None,
|
||||
|
||||
Reference in New Issue
Block a user