Skip to content

fix: preserve Samsung browser input, IME, and hydration compatibility - #698

Merged
trueadm merged 3 commits into
octanejs:mainfrom
openai-oss-forks:fix/samsung-ime-browser-compat
Aug 10, 2026
Merged

trueadm merged 3 commits into
octanejs:mainfrom
openai-oss-forks:fix/samsung-ime-browser-compat

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Preserve native IME composition, editor focus, text selection, and server-rendered DOM identity across controlled updates, keyed reorders, shadow roots, and asynchronous deferred hydration.
  • Restore Samsung Internet / older Chromium compatibility across delegated touch events, background passive effects, browser-safe own-property checks, browser APIs, and build targets.
  • Add consumer-observable regressions covering genuine Korean composition through Playwright/CDP, Galaxy touchscreen emulation, deferred-hydration interruption/rejection, shadow-root focus, and older-browser feature fallbacks.

Why

Samsung/Android keyboards depend on uninterrupted trusted composition and editor focus. Existing controlled-input restoration, keyed movement, and deferred hydration could discard unfinished candidates, interrupt the keyboard, lose focus, commit effects too early, or require a second tap. Several framework paths also assumed browser APIs newer than the advertised Chromium 87 / Samsung Internet 14 module target.

Changes

  • Defer controlled-value restoration while IME composition is active; recover missed composition starts, interrupted sessions, dynamic text-input upgrades, and commits delivered a full task after compositionend.
  • Preserve focused keyed nodes, active Korean IME sessions, ancestor scroll positions, and contentEditable selection across compiled/descriptor reorders, including open shadow roots and older Chromium without moveBefore; restore shadow-hosted focus and selection after unavoidable blur.
  • Keep the original server-rendered editor connected throughout suspending deferred hydration; park refs/effects/store commits transactionally, preserve partially adopted siblings, and discard captured work on abort or rejection.
  • Add touch, input, beforeinput, and composition interactions to the deferred-hydration public contract and subclass-aware/cross-realm event replay while preserving irreversible native default actions.
  • Prevent hidden-tab passive-effect starvation, explicitly support cancelable body-root touch handlers, and gracefully fall back when intersection/media-query observer APIs are unavailable.
  • Cache Object.prototype.hasOwnProperty once and reuse it throughout Octane's client, server, universal, component-capability, method-dependency, and React-bridge modules without requiring Chromium 93+ Object.hasOwn.
  • Support explicit Samsung Internet targets in the Rsbuild plugin, include Samsung Internet 14 in the modules browser target, document the Chromium/Samsung support mapping, and compile the website plus playground runtime to a supported browser baseline.

Validation

  • pnpm format:check
  • pnpm typecheck (complete monorepo, bindings, website, all examples, and benchmark types).
  • Initial full-PR validation included the production Vercel/Nitro build and 397 website unit/integration tests.
  • pnpm test
  • node benchmarks/bundle-size/run-minimal.mjs: all 28 production bundles build, execute, and pass reachability checks; see existing budget overruns and measured deltas below.
  • Targeted development/production runtime, hydration, controlled-input, server/universal-rendering, React-bridge, and Rsbuild browser-target regressions.
  • Real Chromium/Galaxy emulation with trusted CDP Korean IME, async hydration, shadow-root reorders, old-engine movement fallback, and delegated touch cancellation.
  • 688 hydration/controlled-input/focus regressions; 548 SSR/universal-renderer/React-bridge/ownership regressions; 43 real-browser cases; and 25 Rsbuild/Floating UI integration checks.
  • Review regression: connected editors inside nested shadow roots recover focus and selection after blur in development, production, and real Chromium; detached-node and iframe controls still pass.
  • Keyed 1,000-row reverse retains 999 DOM moves and one active-element lookup; timing samples were noisy and do not establish a speedup.

Risk / follow-ups

  • Physical Samsung Internet, Samsung Keyboard, and independently updated Android System WebView were unavailable; browser verification uses real Chromium, Galaxy touchscreen emulation, Samsung user agents, and genuine CDP Korean composition.
  • The documented supported floor is Samsung Internet 14 / Chromium 87. Native inert still requires an application polyfill on older supported engines.
  • Third-party ported libraries are intentionally unchanged; they may have additional compatibility requirements outside this Octane-owned change.
  • Changes touch the keyed reconciler, deferred-hydration transaction, controlled input, and passive scheduler; the PR includes production-mode, abort/rejection, focus/selection, and old-engine regression coverage.
  • Committed bundle budgets were already exceeded on upstream main for deferred hydration, Suspense, and server rendering. Compared with the exact upstream parent, this change adds roughly 1.0 KiB gzip to shared-runtime entries and 1.6 KiB gzip to deferred hydration; 12 additional narrowly budgeted scenarios exceed their committed ceilings. Budgets were not silently increased.

Provenance

  • An agent produced this diff (agent-authored)

Note

High Risk
Touches the render scheduler, keyed reconciler, controlled-input restore path, and deferred-hydration activation transactions—areas where subtle focus/IME bugs are easy to introduce despite extensive test coverage.

Overview
Improves Samsung Internet / Android WebView behavior by keeping native IME composition, editor focus, selection, and the original server DOM node through controlled updates, keyed list reorders, and deferred hydration that suspends mid-activation.

Controlled inputs defer value restoration while composition is active (including missed compositionstart, late commits after compositionend, blur interruption, and dynamic type changes to text). Keyed reconciliation avoids blur during moves via focus-aware insertBefore / sibling rotation when moveBefore is missing, with focus tracking through shadow roots and iframes. Deferred hydration stops cloning fallback over visible SSR content on suspend: it keeps the connected server arm, parks partial adoption (refs/effects), and extends interaction capture to touch/input/composition without preventDefault on events that must stay trusted.

Platform compatibility: shared hasOwnProp instead of Object.hasOwn, passive effects with a hidden-tab timeout fallback, legacy matchMedia listeners, IntersectionObserver absence handling, non-passive delegated touchstart/touchmove, and Rsbuild samsung browser targets plus docs for Chromium/Samsung version mapping.

Reviewed by Cursor Bugbot for commit 0b2a36a. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Aug 10, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit a12ad69. Configure here.

Comment thread packages/octane/src/runtime.ts Resolved
@domgan-oai
domgan-oai marked this pull request as ready for review August 10, 2026 21:52
@trueadm
trueadm merged commit 2d06817 into octanejs:main Aug 10, 2026
35 checks passed
trueadm added a commit that referenced this pull request Oct 2, 2026
The hydration-interactivity and hydration-stress gates have failed on every
weekly Bench run since 2026-08-17 with "octane-tsrx: search typing did not
produce native input events". The search-and-send sample runs inside
`<Hydrate when={interaction()}>`. Since #698 (2d06817), `interaction()`
captures `input` by default: Octane's document capture stops the native event
and replays an untrusted clone once the boundary hydrates, as
docs/deferred-hydration.md describes. The harness counted input with a
document capture listener registered after Octane's, so it never saw
pre-hydration typing. The harness passes at #698's parent and fails at #698.

Count input at window capture, ahead of any page code, and only trusted
events, so a deferred event is still observed and its replayed clone is not
counted twice. The post-hydration check of exactly one native event per typed
character still holds for every target.

Drop the js-framework-reorder waiver for ripple's interleaved keyed inserts.
It expired on 2026-10-01, and ripple 0.4.0 now passes the prepend100 and
insertmid100 identity gates.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants