Skip to content

Conversation

@P-Gill97
Copy link

@P-Gill97 P-Gill97 commented May 5, 2025

@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-wka1pcen May 5, 2025 07:34 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 12, 2025 22:20 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 12, 2025 22:30 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 13, 2025 15:09 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 13, 2025 15:45 Inactive
overlay={true}
zIndex={theme.zIndex.highlightSummaryPopup}
/>
<ModalWrapper aria-modal='true'>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this also have role=dialog?


export function MediaModalPortal(): React.ReactPortal | null {
const [isOpen, setIsOpen] = React.useState(false);
const [modalContent, setModalContent] = React.useState<ReactNode>(null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to handle esc to close

const setClosed = React.useCallback(() => setIsOpen(false), [setIsOpen]);
useOnEsc(isOpen, setClosed);

`;

// tslint:disable-next-line:variable-name
const ModalWrapper = styled.div`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sorta needs to be taking up the whole screen so that it can center things properly, but its gobbling click events so clicking on the overlay isn't closing things. i think you can set a css prop on here to allow click events to pass through and that'll fix it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this whole MediaModalManger setup is pretty convoluted, can you look at the highlightManager and try to share some of the patterns?

don't need the singleton class. stylistically, would be more consistent if it was a function and not a class. PageComponent can construct the manager and store the manager reference

PageComponent should orchestrate managers but there shouldn't be any business logic in there, move all the event listeners into the manager, you can bind your listener to the page component element instead of each individual image so that you don't have to re-apply the listeners when the content changes

return <MinPageHeight>
<this.highlightManager.CardList />
<PT />
<MediaModalPortal />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you look above, the CardList is coming from the manager so that you don't need all the wonky binding logic. if you prefer, you could leave the component separate and pass the manager into it as a prop here, but either of those approaches would be more clear than the singleton binding its doing now

@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 13, 2025 16:22 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-image-preview-9dvhbja3 June 17, 2025 01:17 Inactive
Copy link
Contributor

@RoyEJohnson RoyEJohnson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concerns are addressed; I'll leave the approval for Tom.

@P-Gill97 P-Gill97 requested a review from TomWoodward October 6, 2025 14:52
Comment on lines 19 to 33
useEffect(() => {
setModalContent = (content) => {
setContent(content);
setIsOpen(true);
};
return () => { setModalContent = null; };
}, []);
if (typeof document === 'undefined') return null;

return isOpen ? createPortal(
<MediaModal isOpen={isOpen} onClose={() => setIsOpen(false)}>
{modalContent}
</MediaModal>,
document.body
) : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you look at this? comment still seems outstanding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants