FIX: Chat emoji picker focus offset (#22795)

This commit is contained in:
Jan Cernik 2023-07-26 07:18:10 -03:00 committed by GitHub
parent 5346e7f693
commit c43271eb9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 5 deletions

View File

@ -379,11 +379,18 @@ export default class ChatEmojiPicker extends Component {
}
schedule("afterRender", () => {
document
.querySelector(
`.chat-emoji-picker__section[data-section="${section}"] .emoji:nth-child(1)`
)
.focus();
const firsEmoji = document.querySelector(
`.chat-emoji-picker__section[data-section="${section}"] .emoji:nth-child(1)`
);
const targetEmoji =
[
...document.querySelectorAll(
`.chat-emoji-picker__section[data-section="${section}"] .emoji`
),
].find((emoji) => emoji.offsetTop > firsEmoji.offsetTop) || firsEmoji;
targetEmoji.focus();
later(() => {
// iOS hack to avoid blank div when requesting section during momentum