[Tex/LaTex] How to get rid of height differences in two beamer blocks

beamerblockheight

How come the two blocks have a different height?
What should be changed in \hole definition in order to have the same height?

\documentclass[10pt,lmodern,handout]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{block title}{bg=blue!20}
\setbeamercolor{block body}{bg=blue!5}
\newcommand\hole[1]{%
    \alt<handout>{\invisible<1->{#1}}{#1}%
}
\setbeamertemplate{navigation symbols}{}

%--------------------
\begin{document}
%--------------------

\begin{frame}
\frametitle{Some title}
\framesubtitle{Some subtitle}
Some text.
\begin{block}{A block}
    Text:
    %
    \begin{align*}
        ax=b
    \end{align*}
    %
\end{block}
\begin{block}{A block}
    \hole{Text:
    %
    \begin{align*}
        ax=b
    \end{align*}
    %
    }
\end{block}
Why is there a difference in the two blocks' height? How to get rid of that?
\end{frame}

%---------------%
\end{document}
%---------------%

enter image description here

Best Answer

Adding a \par before closing \hole solves the problem:

\documentclass[10pt,lmodern,handout]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\setbeamertemplate{blocks}[rounded][shadow=true]
\setbeamercolor{block title}{bg=blue!20}
\setbeamercolor{block body}{bg=blue!5}
\newcommand\hole[1]{%
    \alt<handout>{\invisible<1->{#1}}{#1}%
}

\begin{document}

\begin{frame}
\frametitle{Some title}
\framesubtitle{Some subtitle}
Some text.
\begin{block}{A block}
    Text:
    \begin{align*}
        ax=b
    \end{align*}
\end{block}
\begin{block}{A block}
    \hole{Text:
    \begin{align*}
        ax=b
    \end{align*}\par
    }
\end{block}
There's no difference in the two blocks' height!
\end{frame}

\end{document}

The output:

enter image description here

Of course, you could also change the definition of \hole to something like

\newcommand\hole[1]{%
    \alt<handout>{\invisible<1->{#1\par}}{#1}%
}

What's causing the problem? Quite frankly, I've no real idea (although I have some suspicion). In any case, a related question inquiring for the cause of the problem was asked by Kevin_C.