mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 23:07:28 +08:00
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:
@ -276,9 +276,9 @@ export default class ChatComposer extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// hack to prevent the whole viewport
|
// hack to prevent the whole viewport to move on focus input
|
||||||
// to move on focus input
|
// we need access to native node
|
||||||
textarea = document.querySelector(".chat-composer__input");
|
textarea = this.composer.textarea.textarea;
|
||||||
textarea.style.transform = "translateY(-99999px)";
|
textarea.style.transform = "translateY(-99999px)";
|
||||||
textarea.focus();
|
textarea.focus();
|
||||||
window.requestAnimationFrame(() => {
|
window.requestAnimationFrame(() => {
|
||||||
|
Reference in New Issue
Block a user