Here is my minimum working example:
\startuseMPgraphic{FunnyFrame}
picture p ; numeric w, h, o ;
p := textext.rt(\MPstring{FunnyFrame}) ;
w := OverlayWidth ; h := OverlayHeight ; o := BodyFontSize ;
p := p shifted (2o,h-ypart center p) ; draw p ;
drawoptions (withpen pencircle scaled 1pt withcolor black) ;
draw (2o,h)--(0,h)--(0,0)--(w,0)--(w,h)--(xpart urcorner p,h) ;
%draw boundingbox p ;
setbounds currentpicture to unitsquare xyscaled(w,h) ;
\stopuseMPgraphic
\defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
\defineframedtext[FunnyText][frame=off,background=FunnyFrame, width=\textwidth]
\def\StartFrame{\startFunnyText}
\def\StopFrame {\stopFunnyText }
\def\FrameTitle#1%
{\setMPtext{FunnyFrame}{\hbox spread 1em{\hss\strut#1\hss}}}
\setMPtext{FunnyFrame}{}
\define\sidebarA{%
\placefigure[none]{}{%
\FrameTitle{\strut \bf Title}%
\StartFrame%
Text
\StopFrame%
}%
}%
\starttext
\startparagraph
\input knuth
\stopparagraph\reference[myrefA]{myrefA}
\sidebarA
\startparagraph
\input knuth
\stopparagraph
\stoptext
I need to make a reference to the box, which I call a sidebar. I've put \reference[myrefA]{myrefA} near it, so a cross-reference will say "See the sidebar on p. 2". The problem is, its creating a strange vertical space. If I put it anywhere in front of \sidebarA, it makes a gap above the sidebar. And if I put it anywhere after \sidebarA, it puts the gap after. And if I put it inside, it causes some error and it lists as ?? instead of showing the page number. Note that this also happens with floats I have for pictures. The same problem is appearing!
How do I get rid of the extra vertical gap that is appearing where I put my reference?
--Joel