Make chat scrolling events passive

c684d23476f20130e8d2996cb13fd60d5afc1dc7

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +9 -6Showing whitespace changes
public/script.js+9 -6
@@ -9126,10 +9126,6 @@ jQuery(async function () {
91269126 $('#groupCurrentMemberListToggle .inline-drawer-icon').trigger('click');
91279127 }, 200);
91289128
9129- $('#chat').on('wheel touchstart', () => {
9130- scrollLock = true;
9131- });
9132-
91339129 $(document).on('click', '.api_loading', cancelStatusCheck);
91349130
91359131 //////////INPUT BAR FOCUS-KEEPING LOGIC/////////////
@@ -9247,12 +9243,19 @@ jQuery(async function () {
92479243 immediately ? autoFitEditTextArea(e.target) : autoFitEditTextAreaDebounced(e.target);
92489244 }
92499245 });
9250- document.getElementById('chat').addEventListener('scroll', function () {
9246+ const chatElement = document.getElementById('chat');
9247+ chatElement.addEventListener('wheel', function () {
9248+ scrollLock = true;
9249+ }, { passive: true });
9250+ chatElement.addEventListener('touchstart', function () {
9251+ scrollLock = true;
9252+ }, { passive: true });
9253+ chatElement.addEventListener('scroll', function () {
92519254 if (is_use_scroll_holder) {
92529255 this.scrollTop = scroll_holder;
92539256 is_use_scroll_holder = false;
92549257 }
9255- });
9258+ }, { passive: true });
92569259
92579260 $(document).on('click', '.mes', function () {
92589261 //when a 'delete message' parent div is clicked