[Tex/LaTex] LaTeX compilation bug when using todonotes in abstract of elsarticle class document

abstractcompilingelsarticletodonotes

I'm preparing a review using the elsarticle class in LaTeX. There's various threads to keep track of, so I'm using todonotes to note issues so I can keep writing. I've found that using \todo in the abstract environment causes the compilation to pause with the message

! LaTeX Error: Float(s) lost
Hitting return to proceed gives 
! LaTeX Error: This may be a LaTeX bug.
and the only help offered is 
"Call for help" ... HELP!

In a multi-page document I found that the bug upsets the text around other todonotes at the end of a sentence by not inserting space between it and the next sentence.

I could neglect the elsarticle class in favour of preparing the text using article but it would still be nice to get to the bottom of this issue. I don't know where to start with this matter given the not-so-optimistic LaTeX error. Suggestions are welcome.
I thought I'd report this in case this \todo issue affects other document classes.

A minimal working example follows:

 \documentclass[review,numbers,authoryear,sort]{elsarticle}
 \usepackage[textwidth=2.3cm, textsize=scriptsize,color=green!40]{todonotes}
 \setlength{\marginparwidth}{1.5cm}  

\listfiles

\begin{document}

\begin{frontmatter}
\title{To catch a bug \ldots }

 \author[mymainaddress]{me}
\ead{my email}
 \address[mymainaddress]{my address}

\begin{abstract}
I'm having a problem with an Elsevier style file.\todo{Get to the point!} 
Maybe someone at Stackexchange can suggest how to get the todo note to appear?
  \end{abstract}

\end{frontmatter}

\section{Introduction} \label{s:intro}
Words to go here \ldots
\end{document}

Best Answer

The abstract environment immediately typesets the text and saves it in a box, so there can be no float like \todo.

You can do as follows for your drafts, getting a result which is alike the standard. But remember to remove all the additional code together with the “to do notes” when you submit the document.

\documentclass[review,numbers,authoryear,sort]{elsarticle}

%%% Do this only for your drafts
\usepackage[textwidth=2.3cm, textsize=scriptsize,color=green!40]{todonotes}
\usepackage{xpatch,environ,ragged2e}

\setlength{\marginparwidth}{4cm}

\RenewEnviron{abstract}{%
  \xdef\theabstracttext{%
    \unexpanded{%
      \def\baselinestretch{1}\noindent\unskip\textbf{Abstract}\par\medskip
      \noindent\unskip\ignorespaces}%
    \unexpanded\expandafter{\BODY}%
  }%
}
\def\theabstracttext{}
\xpatchcmd{\pprintMaketitle}
  {\ifvoid\absbox}
  {\ifx\theabstracttext\empty\else\printtheabstracttext\fi\ifvoid\absbox}
  {}{}
\newcommand{\printtheabstracttext}{{%
  \begin{trivlist}
  \normalfont\normalsize
  \item\relax
  \theabstracttext
  \end{trivlist}
}}
%%% end addition

\begin{document}

\begin{frontmatter}
\title{To catch a bug \ldots }

\author[mymainaddress]{me}
\ead{my email}
\address[mymainaddress]{my address}

\begin{abstract}
I'm having a problem with an Elsevier style file.\todo{Get to the point!} 
Maybe someone at Stackexchange can suggest how to get the todo note to appear?
\end{abstract}

\end{frontmatter}

\section{Introduction} \label{s:intro}
Words to go here \ldots
\end{document}

enter image description here