SHA256
Чат и обсуждения: шапка не уезжает за экран при открытой клавиатуре
В поиске по переписке после ввода текста шапка с «раньше/позже» уезжала за верхний край экрана, и переключать совпадения было нечем. Причина – scrollIntoView: он прокручивает не только ленту, но и все внешние контейнеры и видимую область браузера, а при открытой клавиатуре видимая область меньше экрана приложения. Теперь прокручивается только сама лента (общий scrollNodeIntoContainer в services/scroll-utils.js): поиск и «перейти к дате», переход к цитате, «к последнему», разделитель «Новые сообщения», а также переходы к ответу и к записи в обсуждениях и ленте канала.
This commit is contained in:
@@ -37,6 +37,7 @@ import { loadProfileSnapshot } from '../services/user-profile-params.js';
|
||||
import { extractLoginFromBlockchainName, makeProfileRoute, makeShineChannelRoute, makeShineMessageRoute } from '../services/shine-routes.js';
|
||||
import { parsePublicationOrdinal, publicationAtOrdinal, ordinalForPublication } from '../services/channel-message-ordinals.js';
|
||||
import { dropPageData, pageDataAge, readPageData, writePageData } from '../services/page-data-cache.js';
|
||||
import { scrollNodeIntoContainer } from '../services/scroll-utils.js';
|
||||
|
||||
export const pageMeta = { id: 'channel-thread-view', title: 'Обсуждение', shellMode: { scrollbar: 'hidden', topFade: false, contentUnderTopbar: false, contentWidth: 'wide' } };
|
||||
const MSG_SUBTYPE_TEXT_POST = 10;
|
||||
@@ -1355,7 +1356,7 @@ function applyPendingScroll(screen, routeKey, shouldContinue = () => true) {
|
||||
const cards = screen.querySelectorAll('.thread-block--replies [data-message-key]');
|
||||
const last = cards[cards.length - 1];
|
||||
if (last) {
|
||||
last.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
scrollNodeIntoContainer(last, { behavior: 'smooth' });
|
||||
}
|
||||
pendingThreadScroll.delete(routeKey);
|
||||
return;
|
||||
@@ -1363,7 +1364,7 @@ function applyPendingScroll(screen, routeKey, shouldContinue = () => true) {
|
||||
|
||||
const node = screen.querySelector(`[data-message-key="${target}"]`);
|
||||
if (node) {
|
||||
node.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
scrollNodeIntoContainer(node, { behavior: 'smooth' });
|
||||
pendingThreadScroll.delete(routeKey);
|
||||
}
|
||||
};
|
||||
@@ -1987,7 +1988,7 @@ export function render({ navigate, route, chrome }) {
|
||||
};
|
||||
returnBtn.addEventListener('click', () => {
|
||||
const el = listWrap.querySelector(`[data-message-key="${CSS.escape(returnKey)}"]`);
|
||||
el?.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
||||
scrollNodeIntoContainer(el, { behavior: 'smooth' });
|
||||
highlight(el);
|
||||
returnBtn.hidden = true;
|
||||
});
|
||||
@@ -1998,7 +1999,7 @@ export function render({ navigate, route, chrome }) {
|
||||
const el = listWrap.querySelector(`[data-message-key="${CSS.escape(key)}"]`);
|
||||
if (!el) return;
|
||||
el.closest('.thread-replies')?.classList.add('is-expanded');
|
||||
el.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
||||
scrollNodeIntoContainer(el, { behavior: 'smooth' });
|
||||
highlight(el);
|
||||
returnKey = fromKey;
|
||||
returnBtn.hidden = false;
|
||||
@@ -2139,7 +2140,7 @@ export function render({ navigate, route, chrome }) {
|
||||
if (!hasPendingScroll && !Number.isFinite(restorePosition) && focusWrap) {
|
||||
trackTimer(window.setTimeout(() => {
|
||||
if (disposed || seq !== refreshSeq || !focusWrap.isConnected) return;
|
||||
focusWrap.scrollIntoView({ behavior: 'auto', block: 'start' });
|
||||
scrollNodeIntoContainer(focusWrap, { block: 'start' });
|
||||
}, 20));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user