Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add platform detection for key set names #491

Open
sbates-idrc opened this issue Apr 30, 2024 · 0 comments · May be fixed by #296
Open

Add platform detection for key set names #491

sbates-idrc opened this issue Apr 30, 2024 · 0 comments · May be fixed by #296
Labels
enhancement New feature or request

Comments

@sbates-idrc
Copy link
Contributor

Comments from Jira

Comment 1 (Tony)

I did some research on this to see what options we have, based on our most recent discussion, in which we agreed that we only need to identify "mac" vs. "not mac", and change the alt/option wording in keyboard menus when the user is on a mac.

The window.navigator object offers a "platform", which is available in Chrome, Firefox, and Safari, and which is consistently "MacIntel" for me. This suggests to me that we'd have to find a list of variations for M1 macs, older OS versions. There are lists out there already. Some of the variations suggest that we'd need to detect a list of:

  • Variations on desktop platforms, including recent versions of the OS and supported processor types.
  • Variations on iOS devices and iOS versions.
  • Variations used with the simulator (not hugely important, but useful for screen shots and testing). (The most recent simulator simply returns "iPad" and "iPhone", so maybe we can just use those).

The window.navigator.userAgent property is also well supported, but would require picking the platform out strings like "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Safari/605.1.15" using some kind of pattern. And there are specific plugins that mask the user agent.

Chromium-derivatives offer a window.navigator.userAgentData property in which the user agent is presented as individual pieces of data. There, window.navigator.userAgentData.platform is better abstracted, simply "macOS".

Comment 2 (Tony)

I also looked at react-device-detect, which already has definitions that let you detect a range of things, including mobile vs. desktop, specific browsers, and of course operating system. The approach seems good, but is probably overkill for what we want.

Comment 3 (Tony)

We agreed to use window.navigator.platform for now.

Original Jira issue

https://fluidproject.atlassian.net/browse/C2LC-539

@sbates-idrc sbates-idrc added the enhancement New feature or request label Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant