[utils] Fix UA-CH browser detection#4900
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,143.38 ms -105.63 ms(-8.5%) | Renders: 50 (+0) | Paint: 1,734.59 ms -160.80 ms(-8.5%)
11 tests within noise — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
What's the motivation for this change? As much as I enjoy getting rid of legacy APIs, if it's working, I wouldn't touch it. The UA string is not going away. |
That’s fair. The existing behavior works for current mainstream UA values. The motivation here wasn’t to remove the legacy UA fallback — this still keeps The narrow issue I was trying to address is that That said, I agree this is more of a correctness hardening than a user-visible bug. If you’d rather avoid touching this while the current behavior works, I’m happy to close the PR. |
|
Thanks but I wouldn't merge it. I see that Edge (and other chromium browsers) have some older versions without support for UA-CH, just on the off chance someone uses such browser, I'd keep the UA check as it is. |
This fixes
detectBrowsersonavigator.userAgentData.brandsis no longer converted into a synthetic user-agent string before browser checks.UA Client Hints expose structured brand data, so Edge detection now checks the
Microsoft Edgebrand directly and keeps the legacynavigator.userAgentfallback for browsers without UA-CH support.References:
Verification: