-
Notifications
You must be signed in to change notification settings - Fork 339
IOS fix: only insert Kapa.ai script for newer versions of IOS #3803
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
base: main
Are you sure you want to change the base?
Conversation
@Blargian is attempting to deploy a commit to the ClickHouse Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR prevents the Kapa.ai widget from loading on iOS versions 16.4 or lower by dynamically inserting the loader script only on supported devices.
- Add
static/js/kapa_widget.js
for runtime iOS version detection and conditional script insertion - Update
docusaurus.config.en.js
to load the new dynamic loader instead of directly embedding Kapa’s bundle
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
static/js/kapa_widget.js | New utility script that checks navigator.userAgent and inserts the widget only on iOS > 16.4 or non-iOS devices |
docusaurus.config.en.js | Replaced direct Kapa script entry with reference to the dynamic loader at /docs/js/kapa_widget.js |
Comments suppressed due to low confidence (3)
static/js/kapa_widget.js:43
- The comment references a "look behind regex," but the code uses a standard
/OS (\d+)(?:_(\d+))?/
pattern. Update or remove the misleading comment.
// Only insert script if not running on older iOS as Kapa does not support it (using a look behind regex)
static/js/kapa_widget.js:12
- The
isOldiOS
function contains branching logic for parsing versions and fallbacks, but there are no unit tests covering iOS UA edge cases (e.g., missing version, malformed strings). Consider adding tests to cover these code paths.
const iosVersionMatch = ua.match(/OS (\d+)(?:_(\d+))?/);
docusaurus.config.en.js:30
- The path
/docs/js/kapa_widget.js
may not match where Docusaurus serves static files (static/js/kapa_widget.js
typically becomes/js/kapa_widget.js
). Verify the correct URL or adjust the path accordingly to avoid a 404.
src: "/docs/js/kapa_widget.js",
try { | ||
insertKapaWidget(); | ||
} catch (e) { | ||
console.log("An error occured while trying to load the Kapa.ai widget:", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix typo in the log message: change occured
to occurred
.
console.log("An error occured while trying to load the Kapa.ai widget:", e); | |
console.log("An error occurred while trying to load the Kapa.ai widget:", e); |
Copilot uses AI. Check for mistakes.
// Return true if iOS version is 16.4 or lower | ||
// (major < 16) OR (major == 16 AND minor <= 4) | ||
return majorVersion < 16 || (majorVersion === 16 && minorVersion <= 4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider extracting 16
and 4
into named constants (e.g., MIN_SUPPORTED_MAJOR
, MIN_SUPPORTED_MINOR
) to improve readability and simplify future version updates.
// Return true if iOS version is 16.4 or lower | |
// (major < 16) OR (major == 16 AND minor <= 4) | |
return majorVersion < 16 || (majorVersion === 16 && minorVersion <= 4); | |
// Return true if iOS version is below the minimum supported version | |
// (major < MIN_SUPPORTED_MAJOR) OR (major == MIN_SUPPORTED_MAJOR AND minor <= MIN_SUPPORTED_MINOR) | |
return majorVersion < MIN_SUPPORTED_MAJOR || (majorVersion === MIN_SUPPORTED_MAJOR && minorVersion <= MIN_SUPPORTED_MINOR); |
Copilot uses AI. Check for mistakes.
Summary
Several users reported issues on IPhone and IPad such as:
I was able to replicate on several older IOS devices and in each case the Ask AI widget is missing and I get this in the console:
Kapa confirmed this is an issue but they will not fix it as it is an incompatibility with older IOS devices.
We will not load the widget on these older devices.
Checklist