browserslist/browserslist-useragent-regexp

[Bug]: Using Chrome Desktop site view on iPad breaks the Regex

Citriik opened this issue · 2 comments

Would you like to work on a fix?

  • Check this if you would like to implement a PR, we are more than happy to help you go through the process.

Current and expected behavior

I'm using this package to create a Regex for this browserlist config:

fully supports es6 and fully supports import-maps
not dead
unreleased versions

The generated Regex is this:

Edge?\/(89|9\d|\d{3,})\.\d+(\.\d+|)|Firefox\/(10[89]|1[1-9]\d|[2-9]\d{2}|\d{4,})\.\d+(\.\d+|)|Chrom(ium|e)\/(89|9\d|\d{3,})\.\d+(\.\d+|)|(Maci|X1{2}).+ Version\/(16\.([4-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})\.\d+)([,.]\d+|)( \(\w+\)|)( Mobile\/\w+|) Safari\/|Chrome.+OPR\/(7[6-9]|[89]\d|\d{3,})\.\d+\.\d+|(CPU[ +]OS|iPhone[ +]OS|CPU[ +]iPhone|CPU IPhone OS|CPU iPad OS)[ +]+(16[._]([4-9]|\d{2,})|(1[7-9]|[2-9]\d|\d{3,})[._]\d+)([._]\d+|)|Android:?[ /-](12[1-9]|1[3-9]\d|[2-9]\d{2}|\d{4,})(\.\d+|)(\.\d+|)|Mobile Safari.+OPR\/(7[3-9]|[89]\d|\d{3,})\.\d+\.\d+|Android.+Firefox\/(12[2-9]|1[3-9]\d|[2-9]\d{2}|\d{4,})\.\d+(\.\d+|)|Android.+Chrom(ium|e)\/(12[1-9]|1[3-9]\d|[2-9]\d{2}|\d{4,})\.\d+(\.\d+|)|Android.+(UC? ?Browser|UCWEB|U3)[ /]?(15\.([5-9]|\d{2,})|(1[6-9]|[2-9]\d|\d{3,})\.\d+)\.\d+|SamsungBrowser\/(1[5-9]|[2-9]\d|\d{3,})\.\d+

It works perfectly except on Chrome iPad when using the site view as desktop mode.

This is the User-Agent for Chrome mobile (the one that works);

Mozilla/5.0 (iPad; CPU OS 17_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/121.0.6167.138 Mobile/15E148 Safari/604.1

Same device but with desktop mode enabled:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/121 Version/11.1.1 Safari/605.1.15

Reproduction

N/A

browserslist-useragent-regexp version

v4.1.1

Possible solution

Fix the generated regex to include desktop view mode.

@Citriik Hi. Please read that #1478 (comment)

Thank you, I'll add Safari 11 to my config :)