Skip to content

Refactor browser fixes and optimize scroll reset behavior for perform… - #6105

Open
Avinash99b wants to merge 1 commit into
SillyTavern:stagingfrom
Avinash99b:perf/mobile-chat-input-optim
Open

Avinash99b wants to merge 1 commit into
SillyTavern:stagingfrom
Avinash99b:perf/mobile-chat-input-optim

Conversation

@Avinash99b

Copy link
Copy Markdown

Checklist

Summary

This branch contains the changes from commit 4c4d9258. It includes two targeted performance and correctness fixes:

Changes

public/scripts/browser-fixes.js

  • Removed the legacy mobile viewport workaround that repeatedly toggled document.documentElement.style.position.
  • This caused unnecessary layout/reflow work during resize events, including Android soft-keyboard transitions.
  • Removed the now-unused isMobile import.

public/scripts/keyboard.js

  • Added a module-level WeakSet to applyScrollResetBehavior.
  • Prevents duplicate focusout listeners from being attached when the function is called repeatedly during DOM/class updates.
  • Uses WeakSet so removed containers can still be garbage-collected.

Why

  • Reduces keyboard and orientation-change jank.
  • Prevents listener accumulation during long sessions.
  • Preserves existing scroll-reset behavior.

Testing

  • Tested keyboard open/close and device rotation on Android/Chrome.
  • Verified scroll-reset containers still reset scrollTop/scrollLeft correctly.
  • Confirmed there are no remaining isMobile references in browser-fixes.js.

Notes

The original commit was force-removed from release (origin/release is now at 8172dcd0) and is maintained on perf/mobile-chat-input-optim. No other release changes are included in this PR.

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