Skip to content

Conversation

@amodhakal
Copy link

Which problem is this PR solving?

BrowserDetector previously relied solely on the presence of navigator to detect browser environments.
Node.js >=21 defines navigator, which caused Node to be misclassified as a browser.

Fixes #6244

Short description of the changes

  • Updated BrowserDetector to explicitly exclude Node.js from browser detection.
  • Added a Node.js-specific regression test (BrowserDetector.node.test.ts) to verify that Node is never detected as a browser.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Added and passed new testing to not detect browser in Node.js even when navigator is defined.
  • Existing browser tests remain unchanged and pass/skipped as expected.

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated (N/A)

@amodhakal amodhakal requested a review from a team as a code owner December 26, 2025 17:53
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Dec 26, 2025

CLA Signed
The committers listed above are authorized under a signed CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BrowserDetector does not accurately detect browsers

1 participant