Let $X,Y,$ and $Z$ be schemes, $Y \hookrightarrow Z$ an immersion so that $Y$ is locally closed in $Z$, and let $\overline{Y}$ be the closure of $Y$ in $Z$. Under what conditions if any can a morphism $f:X \times Y \to Y$ extend to a morphism $X \times \overline{Y} \to \overline{Y}$? I'm looking for both conditions on the $X,Y$, and $Z$ or on $f$ itself, really anything that can be said about this type of situation. The type of thing I had in mind was a group action extending to the closure. The specific case I was looking at are if $X$ and $Y$ are both an algebraic torus $T$, when does the action $T \times T \to T$ extend to $T \times \overline{T} \to \overline{T}$ but really anything that can be said about this at any level of generality would be appreciated.

This question is inspired from my more specific question Are the closures of the tori in the decomposition of a torified variety toric varieties?