SHA256
Чат и обсуждения: шапка не уезжает за экран при открытой клавиатуре
В поиске по переписке после ввода текста шапка с «раньше/позже» уезжала за верхний край экрана, и переключать совпадения было нечем. Причина – scrollIntoView: он прокручивает не только ленту, но и все внешние контейнеры и видимую область браузера, а при открытой клавиатуре видимая область меньше экрана приложения. Теперь прокручивается только сама лента (общий scrollNodeIntoContainer в services/scroll-utils.js): поиск и «перейти к дате», переход к цитате, «к последнему», разделитель «Новые сообщения», а также переходы к ответу и к записи в обсуждениях и ленте канала.
This commit is contained in:
@@ -56,6 +56,7 @@ import {
|
||||
import { parseDmTechBlocks } from '../services/dm-tech-blocks.js';
|
||||
import { dropPageData, readPageData, writePageData } from '../services/page-data-cache.js';
|
||||
import { sortedChannelPublications } from '../services/channel-message-ordinals.js';
|
||||
import { scrollNodeIntoContainer } from '../services/scroll-utils.js';
|
||||
|
||||
export const pageMeta = { id: 'channel-view', title: 'Канал', shellMode: { scrollbar: 'hidden', topFade: false, contentUnderTopbar: false, contentWidth: 'wide' } };
|
||||
const CHANNEL_TYPE_STORIES = 0;
|
||||
@@ -1034,7 +1035,7 @@ function flashAndScrollToMessage(messageRef) {
|
||||
const target = cards.find((card) => card.dataset.messageKey === key);
|
||||
if (!target) return false;
|
||||
target.classList.remove('is-focus-flash');
|
||||
target.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
scrollNodeIntoContainer(target, { behavior: 'smooth' });
|
||||
window.setTimeout(() => {
|
||||
if (target.isConnected) target.classList.add('is-focus-flash');
|
||||
}, 60);
|
||||
@@ -1602,9 +1603,7 @@ function renderDemoFallback(screen, navigate, error) {
|
||||
|
||||
function scrollChannelToBottom(screen, smooth = true) {
|
||||
const feed = screen.querySelector('.channel-feed');
|
||||
if (feed) {
|
||||
feed.scrollIntoView({ behavior: smooth ? 'smooth' : 'auto', block: 'end' });
|
||||
}
|
||||
if (feed) scrollNodeIntoContainer(feed, { block: 'end', behavior: smooth ? 'smooth' : 'auto' });
|
||||
const appScreen = document.getElementById('app-screen');
|
||||
if (appScreen) {
|
||||
appScreen.scrollTo({ top: appScreen.scrollHeight, behavior: smooth ? 'smooth' : 'auto' });
|
||||
@@ -1631,7 +1630,7 @@ function applyPendingScroll(screen, routeKey, forceBottom = false) {
|
||||
|
||||
const element = screen.querySelector(`[data-message-key="${target}"]`);
|
||||
if (element) {
|
||||
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
scrollNodeIntoContainer(element, { behavior: 'smooth' });
|
||||
pendingScrollByRoute.delete(routeKey);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user