SHA256
Merge remote-tracking branch 'origin/main'
# Conflicts: # VERSION.properties
This commit is contained in:
@@ -914,6 +914,10 @@ export function render({ navigate, route }) {
|
||||
emojiToggle?.setAttribute('aria-expanded', 'false');
|
||||
};
|
||||
|
||||
// На сенсорных устройствах фокус в textarea поднимает клавиатуру поверх пикера —
|
||||
// поэтому при вставке эмодзи фокусируем поле только там, где есть «точный» указатель.
|
||||
const isFinePointer = window.matchMedia?.('(hover: hover) and (pointer: fine)')?.matches ?? true;
|
||||
|
||||
const insertEmoji = (emoji) => {
|
||||
if (!input) return;
|
||||
const value = String(input.value || '');
|
||||
@@ -922,11 +926,13 @@ export function render({ navigate, route }) {
|
||||
input.value = `${value.slice(0, start)}${emoji}${value.slice(end)}`;
|
||||
const nextPosition = start + emoji.length;
|
||||
emojiSelection = { start: nextPosition, end: nextPosition };
|
||||
input.focus();
|
||||
try {
|
||||
input.setSelectionRange(nextPosition, nextPosition);
|
||||
} catch {
|
||||
// Ignore browsers that do not expose textarea selection during focus changes.
|
||||
if (isFinePointer) {
|
||||
input.focus();
|
||||
try {
|
||||
input.setSelectionRange(nextPosition, nextPosition);
|
||||
} catch {
|
||||
// Ignore browsers that do not expose textarea selection during focus changes.
|
||||
}
|
||||
}
|
||||
autoResizeComposer(input);
|
||||
};
|
||||
@@ -1247,6 +1253,9 @@ export function render({ navigate, route }) {
|
||||
emojiPickerOpen = !emojiPickerOpen;
|
||||
emojiSlot.hidden = !emojiPickerOpen;
|
||||
emojiToggle.setAttribute('aria-expanded', String(emojiPickerOpen));
|
||||
// Как в Telegram: либо клавиатура, либо пикер. На тач-устройствах при
|
||||
// открытии пикера прячем клавиатуру, чтобы поле ввода оставалось видно.
|
||||
if (emojiPickerOpen && !isFinePointer) input?.blur();
|
||||
});
|
||||
screen.addEventListener('pointerdown', (event) => {
|
||||
if (!emojiPickerOpen || form.contains(event.target)) return;
|
||||
|
||||
Reference in New Issue
Block a user