When you say “custom coded”, do you mean you coded a drag-and-drop interaction via JS on an HTML object? Or something else?
If the former, I would tie the “Next Page” action to the clicking of the “OK” button. Is the message that appears on-screen custom-coded as well?
Depending on the specific implementation, it might even be easier to remove the Lectora-default “next page” action for that slide, and replace it with your own custom-code that navigates to the next page which you could tie directly to the “OK” button.