Skip to content

fix: rewrite /keyboards for embed mode and skip localization#734

Merged
mcdurdin merged 1 commit into
stagingfrom
fix/keyboards-redirect
May 12, 2026
Merged

fix: rewrite /keyboards for embed mode and skip localization#734
mcdurdin merged 1 commit into
stagingfrom
fix/keyboards-redirect

Conversation

@mcdurdin
Copy link
Copy Markdown
Member

Keyman 14.0 - 18.0 have a dependency on /keyboards which means that we cannot rewrite URLs there when we are in 'embed' mode for those apps. The apps check if the URL starts with /keyboards, and handle those paths internally, while opening other URLs in an external browser.

See keymanapp/keyman#15948 for platform-specific dependencies on this behaviour and for v19.0 planned mitigations.

Also remove _ie_thunk and _legacy from .htaccess as these are no longer required following removal of pre-Keyman-13.0 support.

Relates-to: keymanapp/keyman#15948
Test-bot: skip

Keyman 14.0 - 18.0 have a dependency on /keyboards which means that we
cannot rewrite URLs there when we are in 'embed' mode for those apps.
The apps check if the URL starts with /keyboards, and handle those paths
internally, while opening other URLs in an external browser.

See keymanapp/keyman#15948 for
platform-specific dependencies on this behaviour and for v19.0 planned
mitigations.

Also remove _ie_thunk and _legacy from .htaccess as these are no longer
required following removal of pre-Keyman-13.0 support.

Relates-to: keymanapp/keyman#15948
@keymanapp-test-bot
Copy link
Copy Markdown

User Test Results

Test specification and instructions

User tests are not required

@keymanapp-test-bot keymanapp-test-bot Bot added this to the A19S29 milestone May 12, 2026
@github-actions github-actions Bot added the fix label May 12, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Keyman May 12, 2026
@mcdurdin mcdurdin requested a review from darcywong00 May 12, 2026 09:09
Comment on lines -297 to +306
$('.title a', k).text(kbd.name).attr('href', `/${I18n.pageLocale()}/keyboards/h/${kbd.id}${embed_query_q}`);
$('.title a', k).text(kbd.name).attr('href', `${page_root}/h${kbd.id}${embed_query_q}`);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note deletion of extra / after h which was previously incorrect, because the dedicated landing pages always have a preceding /:

const dedicatedLandingPages = [
{
id: "/amharic",

Comment thread .htaccess
Comment on lines +51 to +53
RewriteCond "%{HTTP_COOKIE}" embed_keyboards_no_locale_redirect [OR]
RewriteCond "%{QUERY_STRING}" embed
RewriteRule "^keyboards/install/([^/]+)$" "/_content/keyboards/install.php?id=$1" [END,QSA]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern here is similar through this section:

  1. Add the two RewriteCond lines ([OR] flag reduces number of rules!)
  2. Strip the BCP47 component from the path
  3. Adjust $2 references to $1.

Copy link
Copy Markdown
Contributor

@darcywong00 darcywong00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

For 19.0 apps, would we tweak /go/ links in #730?

$session_query_q = "?$session_query";
} else {
$session_query = '';
$session_query_q = '';
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to delete the cookie?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's a session cookie, so will expire by itself when the session ends.

@mcdurdin mcdurdin merged commit 031ef72 into staging May 12, 2026
6 checks passed
@mcdurdin mcdurdin deleted the fix/keyboards-redirect branch May 12, 2026 11:01
@github-project-automation github-project-automation Bot moved this from Todo to Done in Keyman May 12, 2026
@mcdurdin
Copy link
Copy Markdown
Member Author

lgtm.

For 19.0 apps, would we tweak /go/ links in #730?

We'll need to design the scheme carefully and document that in keymanapp/keyman#15948. I think we can address that all separately, after epic/web-i18n lands. The apps will need refreshing to support the new pathways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants