ua-parser-js icon indicating copy to clipboard operation
ua-parser-js copied to clipboard

The Samsung Galaxy Tab S8 is falsely identified as a mobile device.

Open kNoAPP opened this issue 1 year ago • 1 comments

Root cause: https://github.com/faisalman/ua-parser-js/blob/master/src/ua-parser.js#L376-L381

The problem: The regex for Samsung mobile devices matches the Tab S8's device number SM-X706B with the regex \b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus). But does not match the tablet's regex of \b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10). Thus, it is being treated as a mobile device. This is not the expected behavior. The Tab S8 should be treated as a tablet device.

For confidence testing, I have also tried the S7's device number SM-T875 which successfully registered as a tablet device. Interestingly, it also passes the mobile device regex-- though this doesn't cause any unwanted/unexpected behavior.

I have not tested earlier tablets from Samsung.

I will propose a PR to fix the regex for the Tab S8 device shortly.

kNoAPP avatar Sep 20 '22 18:09 kNoAPP

The PR I have linked should resolve the issue. Thanks!

kNoAPP avatar Sep 20 '22 19:09 kNoAPP