Focus the correct status in media modal

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2023-07-03 13:39:11 +02:00
parent 42e9d31a3e
commit 55b1f9be67
3 changed files with 10 additions and 7 deletions

View File

@@ -122,6 +122,9 @@ const Thread = (props: IThread) => {
};
});
let initialTopMostItemIndex = ancestorsIds.size;
if (!useWindowScroll && initialTopMostItemIndex !== 0) initialTopMostItemIndex = ancestorsIds.size + 1;
const [showMedia, setShowMedia] = useState<boolean>(status?.visibility === 'self' ? false : defaultMediaVisibility(status, displayMedia));
const node = useRef<HTMLDivElement>(null);
@@ -407,7 +410,7 @@ const Thread = (props: IThread) => {
if (!useWindowScroll) {
// Add padding to the top of the Thread (for Media Modal)
children.push(<div className='h-4' />);
children.push(<div key='padding' className='h-4' />);
}
if (hasAncestors) {
@@ -444,7 +447,7 @@ const Thread = (props: IThread) => {
hasMore={!!next}
onLoadMore={handleLoadMore}
placeholderComponent={() => <PlaceholderStatus variant='slim' />}
initialTopMostItemIndex={ancestorsIds.size}
initialTopMostItemIndex={initialTopMostItemIndex}
useWindowScroll={useWindowScroll}
itemClassName={itemClassName}
className={