Thanks for your help, but my guess is that there's something else that has to be done inside of libcef.dll to make the original bug fix work in the case of a derived CefJSDialogHandler.
Just to clarify (not sure if it was clear), the problem here is not simply trying to automatically refocus the browser element that was focused before the message box. The problem is that once a that message box shows and goes away, the user cannot click on *any* text input in the program to focus it. You have to alt-tab to another application and then back to the cefclient application to make it so you can click and focus text boxes again.
Here is the code I tried for your first idea, which made no difference.
- Code: Select all
case JSDIALOGTYPE_ALERT:
{
CefRefPtr<CefFrame> frame = browser->GetFocusedFrame();
browser->GetHost()->SendCaptureLostEvent();
MessageBox( browser->GetHost()->GetWindowHandle(), message_text.c_str(), L"Tier2 Submit", MB_OK );
browser->GetHost()->SetFocus( true );
callback->Continue( true, "" );
return true;
}
I didn't try your second idea because it seemed more specifically about just trying to refocus the element that had focus.
For now I'm just going to avoid use of alert() and use message boxes made of DOM elements.