Skip to content

Fix that weird scrolling issue in ios when keyboard is shown#166

Merged
matheusfillipe merged 54 commits into
mainfrom
fix/ios-fucking-webkit-sucks-scroll-issue-fork-rust-plugin-aah
Apr 13, 2026
Merged

Fix that weird scrolling issue in ios when keyboard is shown#166
matheusfillipe merged 54 commits into
mainfrom
fix/ios-fucking-webkit-sucks-scroll-issue-fork-rust-plugin-aah

Conversation

@matheusfillipe
Copy link
Copy Markdown
Contributor

@matheusfillipe matheusfillipe commented Apr 12, 2026

  • Fix that weird scrolling issue in ios when keyboard is shown

Summary by CodeRabbit

Release Notes

  • New Features

    • Added iOS keyboard plugin with real-time keyboard event detection (show/hide events)
    • Keyboard state now includes height and animation duration for smooth UI coordination
  • Bug Fixes

    • Fixed scroll behavior conflicts by removing unnecessary style overrides
  • Chores

    • Updated iOS keyboard plugin dependency configuration

…oad-more

  Messages during a chathistory batch are now held in pendingMessages and flushed
  to state in one setState at BATCH_END, so history appears all at once instead of
  one by one.

  Scroll position is preserved via a useLayoutEffect delta correction
  (scrollTop += newHeight - prevHeight) instead of CSS scroll anchoring, which was
  unreliable on WKWebView flex containers and caused double-jumps in browser when
  both mechanisms ran simultaneously. overflow-anchor:none disables the browser's
  native anchoring so only our correction runs.

  Also fixes: scroll-to-bottom button showing stale true on channel switch, load
  older messages button not appearing on chathistory-capable servers.
  - Narrow ChannelMessageList selector to per-channel key (was subscribing
    to full messages map, causing re-render on every incoming message)
  - Wrap MessageItem in memo + useMemo markdown processing
  - Lazy-load highlight.js (969KB deferred from initial bundle)
  - Replace opacity:0 with visibility:hidden on message action bars
  - Split vendor chunks (react, markdown, zustand) for better caching
  - Fix reactions and replies lost during chathistory batch playback
  - Inline MdAddReaction/RiReplyFill SVGs to drop react-icons sub-packages
@matheusfillipe matheusfillipe changed the base branch from main to feat/bugfixes-and-refactor April 12, 2026 22:54
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 12, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This PR introduces a new tauri-plugin-ios-keyboard plugin for iOS, transitioning from an external crate dependency to a local path-based implementation. It includes comprehensive Swift and Rust plugin scaffolding, keyboard event detection and observation, and permission configuration files for iOS keyboard integration.

Changes

Cohort / File(s) Summary
Cargo.toml Root Dependency
src-tauri/Cargo.toml
Updated iOS keyboard plugin dependency from crates.io version pin to local path (plugins/ios-keyboard).
Tauri iOS API Scaffolding
src-tauri/plugins/ios-keyboard/.tauri/tauri-api/*
Establishes foundational Swift interop layer with Package.swift manifest, JSON/JS type abstractions (JSTypes, JsonValue), channel and invoke handling, logging redirection, plugin base class, and UI utilities for iOS Tauri plugins.
iOS Keyboard Plugin Rust
src-tauri/plugins/ios-keyboard/Cargo.toml, build.rs, src/*
Implements Rust plugin layer with command handling (ping), platform-specific desktop/mobile initialization, error types, and data models; sets up build toolchain for Tauri plugin generation.
iOS Keyboard Plugin Swift Implementation
src-tauri/plugins/ios-keyboard/ios/Package.swift, Sources/KeyboardPlugin.swift, Package.resolved
Provides native iOS keyboard event observation via UIResponder notifications, forwards keyboard show/hide events to JavaScript, and coordinates webview scroll behavior with keyboard state.
iOS Keyboard Permissions & Configuration
src-tauri/plugins/ios-keyboard/permissions/*
Defines permission schema (JSON Schema, permission sets, autogenerated command permissions for ping) and documentation table.
Frontend Adjustments
src/hooks/useKeyboardResize.ts, src/index.css
Removes redundant iOS keyboard mutation of overscrollBehavior; adds global CSS rule to suppress document scroll and overscroll behavior on HTML element.

Sequence Diagram(s)

sequenceDiagram
    participant iOS as iOS UIResponder
    participant Swift as KeyboardPlugin (Swift)
    participant Rust as Plugin Manager (Rust)
    participant JS as JavaScript Layer

    iOS->>Swift: keyboardWillShow/keyboardDidShow Notification
    Swift->>Swift: Extract keyboard height & animation duration
    Swift->>Rust: trigger("plugin:keyboard::ios-keyboard-event", KeyboardEvent)
    Rust->>JS: Send keyboard event via IPC

    iOS->>Swift: keyboardWillHide Notification
    Swift->>Swift: Set keyboard height to 0
    Swift->>Rust: trigger("plugin:keyboard::ios-keyboard-event", KeyboardEvent)
    Rust->>JS: Send keyboard event via IPC
    JS->>JS: Update layout / trigger handlers
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • feat/add image viewer #162 — Introduces similar Tauri iOS bridge/API scaffolding (Channel, Invoke, JSTypes, JsonValue, Logger, Plugin classes) for a different plugin (share-sheet), indicating a shared pattern for iOS plugin development.

Suggested reviewers

  • ValwareIRC

Poem

🐰 Hop along the iOS shore,
Keyboard events we now adore!
Swift and Rust in harmony blend,
From UIResponder to JavaScript end!
The plugin path now local, no more delay—
A rabbit's touch makes keyboards play! 🎹

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.70% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix that weird scrolling issue in ios when keyboard is shown' directly addresses the main objective of this PR and aligns with the central change: resolving keyboard-related scrolling problems on iOS.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ios-fucking-webkit-sucks-scroll-issue-fork-rust-plugin-aah

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Pages Preview
Preview URL: https://fix-ios-fucking-webkit-sucks.obsidianirc.pages.dev

Automated deployment preview for the PR in the Cloudflare Pages.

@matheusfillipe matheusfillipe changed the title fix/ios fucking webkit sucks scroll issue fork rust plugin aah Fix that weird scrolling issue in ios when keyboard is shown Apr 12, 2026
Base automatically changed from feat/bugfixes-and-refactor to main April 13, 2026 16:01
…o fix/ios-fucking-webkit-sucks-scroll-issue-fork-rust-plugin-aah
@matheusfillipe matheusfillipe merged commit ee780d4 into main Apr 13, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant