sindresorhus / open

Open stuff like URLs, files, executables. Cross-platform.
MIT License
3.18k stars 219 forks source link

Browser tab opens, but does not focus or come to front #325

Open broofa opened 11 months ago

broofa commented 11 months ago

As the title says, I have a minimal use case shown below. When I run this script, it opens a browser tab, but fails to bring Chrome to the front or give it focus.

Passing {background:false} for options does not change this behavior.

'Feels like I'm missing something obvious... 😕

import open from 'open';
open('https://npmgraph.js.org/');

CleanShot 2023-10-23 at 07 14 29


$ envinfo

  System:
    OS: macOS 13.4
    CPU: (10) arm64 Apple M1 Max
    Memory: 10.56 GB / 64.00 GB
    Shell: 5.2.15 - /opt/homebrew/bin/bash
  Binaries:
    Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.20.2/bin/yarn
    npm: 8.19.4 - ~/.nvm/versions/node/v16.20.2/bin/npm
    Watchman: 2023.10.09.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 118.0.5993.88
    Firefox: 118.0.2
    Safari: 16.5
  npmPackages:
    @types/node: 20.5.9 => 20.5.9
    @typescript-eslint/eslint-plugin: 6.6.0 => 6.6.0
    @typescript-eslint/parser: 6.6.0 => 6.6.0
    chalk: 5.3.0 => 5.3.0
    commander: 11.1.0 => 11.1.0
    open: 9.1.0 => 9.1.0
    prettier: 3.0.3 => 3.0.3
    standard-version: 9.5.0 => 9.5.0
    typescript: 5.2.2 => 5.2.2