mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 01:56:58 +08:00
FIX: simplify body scroll lock on iOS (#30696)
This will have the following advantages: - removes a very annoying bug which was making text selection super hard on iOS - removes the flashing of header when transitioning from disable to enable body scroll lock
This commit is contained in:
@ -12,10 +12,6 @@ import { Promise } from "rsvp";
|
||||
import EmojiPickerDetached from "discourse/components/emoji-picker/detached";
|
||||
import InsertHyperlink from "discourse/components/modal/insert-hyperlink";
|
||||
import { SKIP } from "discourse/lib/autocomplete";
|
||||
import {
|
||||
disableBodyScroll,
|
||||
enableBodyScroll,
|
||||
} from "discourse/lib/body-scroll-lock";
|
||||
import { setupHashtagAutocomplete } from "discourse/lib/hashtag-autocomplete";
|
||||
import { emojiUrlFor } from "discourse/lib/text";
|
||||
import userSearch from "discourse/lib/user-search";
|
||||
@ -285,22 +281,20 @@ export default class ChatComposer extends Component {
|
||||
}
|
||||
|
||||
@action
|
||||
onTextareaFocusOut(event) {
|
||||
onTextareaFocusOut() {
|
||||
this.isFocused = false;
|
||||
enableBodyScroll(event.target);
|
||||
}
|
||||
|
||||
@action
|
||||
onTextareaFocusIn(event) {
|
||||
this.isFocused = true;
|
||||
const textarea = event.target;
|
||||
disableBodyScroll(textarea);
|
||||
|
||||
if (!this.capabilities.isIOS) {
|
||||
return;
|
||||
}
|
||||
|
||||
// hack to prevent the whole viewport to move on focus input
|
||||
const textarea = event.target;
|
||||
textarea.style.transform = "translateY(-99999px)";
|
||||
textarea.focus();
|
||||
window.requestAnimationFrame(() => {
|
||||
|
@ -22,5 +22,7 @@
|
||||
color: var(--primary-medium);
|
||||
font-size: var(--font-down-1);
|
||||
padding: 0.5em 0.25em 0.25em;
|
||||
touch-action: none;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user