  A Gabor orthonormal basis, on a locally compact Abelian (LCA) group $A$, is
an orthonormal basis of $L^2(A)$ which consists of time-frequency shifts of
some template $f\in L^2(A)$. It is well-known that, on $\mathbb{R}^d$, the
elements of such a basis cannot have a good time-frequency localization. The
picture is drastically different on LCA groups containing a compact open
subgroup, where one can easily construct examples of Gabor orthonormal bases
with $f$ maximally localized, in the sense that the ambiguity function of $f$
(i.e. the correlation of $f$ with its time-frequency shifts) has support of
minimum measure, compatibly with the uncertainty principle. In this paper we
find all the Gabor orthonormal bases with this extremal property. To this end,
we identify all the functions in $L^2(A)$ which are maximally localized in the
time-frequency space in the above sense -- an issue which is open even for
finite Abelian groups. As a byproduct, on every LCA group containing a compact
open subgroup, we exhibit the complete family of optimizers for Lieb's
uncertainty inequality, and we also show previously unknown optimizers on a
general LCA group.
