I’m using the native UWebBrowser in UE5.8 for a interactive HTML.
I want clicks on the HTML background to pass through to the game, while buttons and inputs remain interactive, all within a single WebBrowser widget.
CSS pointer-events: none doesn’t seem to help because the WebBrowser still captures the entire widget area. Setting it to Not Hit-Testable (Self & All Children) disables everything.
I also tested the following HTML. The content before <!DOCTYPE html> and after </html> is rendered and selectable, but the area still blocks mouse input to the game. CSS pointer-events doesn’t seem to change this behavior.
<span style="display: inline-block; background-color: pink"> AAA </span>
<!DOCTYPE html>
<html>
<body>
<div style="background: red; padding: 30px;">
HTML BODY
</div>
</body>
</html>
BBB
Click Interaction
Within the AAA, the span:
LogBlueprintUserMessages: [HUD_C_C_0] HTML recibió pointerdown: [object HTMLSpanElement]
LogBlueprintUserMessages: [HUD_C_C_0] HTML recibió click: [object HTMLSpanElement]
Since AAA is a span, I click on “that unknown area” just the same:
LogBlueprintUserMessages: [HUD_C_C_0] HTML recibió pointerdown: [object HTMLBodyElement]
LogBlueprintUserMessages: [HUD_C_C_0] HTML recibió click: [object HTMLBodyElement]
We are inside a HTMLBodyElement.
Inside the red div element:
LogBlueprintUserMessages: [HUD_C_C_0] HTML recibió pointerdown: [object HTMLDivElement]
LogBlueprintUserMessages: [HUD_C_C_0] HTML recibió click: [object HTMLDivElement]
I've made it this far, but it's starting to look like this isn't my fault.
FReply FWebBrowserViewport::OnMouseButtonDown(const FGeometry& *MyGeometry*, const FPointerEvent& *MouseEvent*)
{
*// Capture mouse on left/middle/right button down so that you can drag out of the viewport*
FReply Reply = WebBrowserWindow->OnMouseButtonDown(*MyGeometry*, *MouseEvent*, bIsPopup);
if (*MouseEvent*.GetPressedButtons().Num() == 1 &&
(*MouseEvent*.GetEffectingButton() == EKeys::LeftMouseButton || *MouseEvent*.GetEffectingButton() == EKeys::MiddleMouseButton || *MouseEvent*.GetEffectingButton() == EKeys::RightMouseButton))
{
const FWidgetPath\* Path = *MouseEvent*.GetEventPath();
if (Path->IsValid())
{
TSharedRef<SWidget> TopWidget = Path->Widgets.Last().Widget;
return Reply.CaptureMouse(TopWidget);
}
}
return Reply;
}
Not Hit-Testable (Self): FWebBrowserViewport::OnMouseButtonDown() executes and reaches Reply.CaptureMouse(TopWidget).
Not Hit-Testable (Self & All Children): execution of the function stops.
Is there a way to make these non-interactive areas pass mouse input through to the game using the native UE5.8 WebBrowser?
