Enterprise: IDS components not working at all in Chrome/Edge on OSX Big Sur

Created on 16 Nov 2020  路  11Comments  路  Source: infor-design/enterprise

Describe the bug
Cannot use the controls in Chrome/Edge on the new OSX Big Sur.

To Reproduce

  1. Go to https://design.infor.com/code/ids-enterprise/latest/demo/components/autocomplete/example-index
  2. Open Dev console
  3. See errors

The original error seems to occur in environment.js, where the regex for OSX version fails. Big Sur is 11.x, not 10.x. Other errors following due to this?

Version

  • ids-enterprise: latest

Screenshots
screenshot-1

Platform

  • OS Version: OSX Big Sur
  • Browser Name: Chrome / Edge

Additional context

 case 'Mac OS X':
        osVersion = /Mac OS X (10[\.\_\d]+)/.exec(nUAgent)[1].replace(/\_/g, '.'); <--- This is the failing line
        break;

Works in Safari. navigator.userAgent is "Mac OS 10_15_6" in Safari, but "Mac OS 11_0_0" in Chrome / Chromium browsers.

[2] high type

All 11 comments

@volante007 so what would the fix look like exactly? I'm not able to test this due to IT locking us down

@tmcconechy I can't test this either, I just investigated based on the screenshot. I assume that the regex must be updated to support 10 _or_ 11, e.g. this one /Mac OS X (10[\.\_\d]+)/ , to avoid the null array type error. It should find version 11.0.0 in the Chrome userAgent for Big Sur.

OK i can use this test...

nUAgent10 = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
/Mac OS X (10[\.\_\d]+)/.exec(nUAgent)[1].replace(/\_/g, '.')
/Mac OS X (10[\.\_\d]+)/.exec(nUAgent10)[1].replace(/\_/g, '.')
nUAgent11 = "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_00_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_00_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36"
/Mac OS X (10[\.\_\d]+)/.exec(nUAgent11)[1].replace(/\_/g, '.')

Fix is building will make a patch and then add a link you can test (if you have big sur). https://github.com/infor-design/enterprise/commit/1f6a7e160054578e31e4b24bf372c6c8804cd5bb

Fixed and patch in 4.34.2 (7.8.3 and 8.1.2)

@tmcconechy what about other versions? I believe since this might require hotfix for all released versions, only patching 7.8.3 and 8.1.2 would force adopters to update ids-enterprise-version just to get this fix, which may cause additional problems.

maybe this might be an overkill, but shouldn't all major and minor releases be patched too?

That isn't that easy. But i am willing to patch maybe the last 2-3? Not all the way back 30+ major versions. Also easier if we just patch EP and you include it in NG so we don't have to re-release all the NG versions.

What version do you want in particular?

I just checked couple of projects and I see 7.4.0, 7.5.3, 7.5.0, 7.5.5, 8.1.0 and these are just the ones that I can access.
I wonder if perhaps this could be a less dangerous "hack" inside index.html (I tested my Chrome like this to break it). Replacing the 11 with 10 should on the other hand be a fix

    <script>
      Object.defineProperty(navigator, 'userAgent', {
        get: function () { return `Mozilla/5.0 (Macintosh; Intel Mac OS X 11_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36`; }
      });
    </script>

Ok, Thats a good start but that would change all of the userAgents for all browsers. What about this for a script to "fix" it.

So you would include this ahead of the sohoxi.js scripts?

<script>
var agent = navigator.userAgent;
if (agent && agent.indexOf('Mac OS X 11') > -1 && agent.indexOf('Chrome') > -1) {
   const newAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_99_9)' + agent.substr(navigator.userAgent.indexOf(') ')+1, navigator.userAgent.length);
   Object.defineProperty(navigator, 'userAgent', {
     get: function () { 
       return newAgent;
     }
   });
}
</script>

Maybe that will help folks that dont want to update or have patching issues? (Needs further testing)

Ok, Thats a good start but that would change all of the userAgents for all browsers. What about this for a script to "fix" it.

So you would include this ahead of the sohoxi.js scripts?

<script>
var agent = navigator.userAgent;
if (agent && agent.indexOf('Mac OS X 11') > -1 && agent.indexOf('Chrome') > -1) {
   const newAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_99_9)' + agent.substr(navigator.userAgent.indexOf(') ')+1, navigator.userAgent.length);
   Object.defineProperty(navigator, 'userAgent', {
     get: function () { 
       return newAgent;
     }
   });
}
</script>

Maybe that will help folks that dont want to update or have patching issues? (Needs further testing)

This way works for me. So far I havent seen any issues.

Great thanks @ahnpnl I guess this can be an option then.

Was this page helpful?
0 / 5 - 0 ratings