In the following MWE \ref{a}
and \ref{aa}
show 1 and 2a instead of 1.1 and 1.2.1, respectively. I wonder how this can be fixed.
\documentclass{article}
\usepackage{enumerate}
\renewcommand{\labelenumi}{\thesection.\arabic{enumi}}
\renewcommand{\labelenumii}{\thesection.\arabic{enumi}.\arabic{enumii}}
\begin{document}
\section{Section Title}
Item \ref{a} and Item \ref{aa}.
\begin{enumerate}
\item \label{a} A
\item B
\begin{enumerate}
\item \label{aa} AA
\item BB
\end{enumerate}
\end{enumerate}
\end{document}