Focus the correct status in media modal
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
@@ -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={
|
||||
|
||||
Reference in New Issue
Block a user