FIX: allows to focus thread's composer on ipad (#22639)

On iOS we have a hack to prevent the viewport to move when focusing an input, however this code was targeting the textarea node through a global selector which is working fine on iOS as we only show one composer at a time but was failing on iPad as we show both channel and thread on the same screen. As a result `document.querySelector(".chat-composer__input")` was always targeting the first textarea on the screen which was the channel's composer, making it impossible to focus the thread's one.
This commit is contained in:
Joffrey JAFFEUX 2023-07-17 14:38:29 +02:00 committed by GitHub
parent d44c9cf065
commit fe8d9b6b4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -276,9 +276,9 @@ export default class ChatComposer extends Component {
return;
}
// hack to prevent the whole viewport
// to move on focus input
textarea = document.querySelector(".chat-composer__input");
// hack to prevent the whole viewport to move on focus input
// we need access to native node
textarea = this.composer.textarea.textarea;
textarea.style.transform = "translateY(-99999px)";
textarea.focus();
window.requestAnimationFrame(() => {