Context Menu out of View port

I’m implementing a context menu with native HTML.
When the node is near the view port edge, the context menu is opened down ward and it not shown in the view port.
See attached pic :

How can i open the context menu upward ?

Make your function smarter about where to position the HTML that you are showing. GoJS HTML Interaction -- Northwoods Software