WebPanel doesn't seem to work.

Started by FangStriker · 5 months ago · 1 reply · 40 views

#1
FangStriker
Member
JoinedApr 2026 Posts9 Score343
I'm referencing a WebPanel through a razor panel. The WebPanel class is loading correctly and no errors are being thrown, however the webpage requested doesn't actually visually display in the UI. I'm using example.com as a test and nothing shows.

using Sandbox;
using Sandbox.UI;

public class BrowserPanel : WebPanel
{
    public const string DefaultUrl = "https://example.com";

    public BrowserPanel()
    {
        Style.Width = Length.Percent( 100 );
        Style.Height = Length.Percent( 100 );
        Style.BackgroundColor = Color.Black.WithAlpha( 0.15f );
    }

    public void Navigate( string url )
    {
        Url = string.IsNullOrWhiteSpace( url ) ? DefaultUrl : url;
        Log.Info( $"Loading page: {Url}" );
    }

    public override void OnButtonEvent( ButtonEvent e )
    {
        // Optional: intercept inputs before/after base call
        // Example: close on Escape
        if ( e.Pressed && e.Button == "escape" )
        {
            Delete();
            return;
        }

        base.OnButtonEvent( e );
    }

    public override void OnKeyTyped( char k )
    {
        base.OnKeyTyped( k );

        Log.Info( $"Typed into web panel: {k}" );
    }

    protected override void OnFocus( PanelEvent e )
    {
        base.OnFocus( e );
        Log.Info( "Browser panel focused" );
    }

    protected override void OnBlur( PanelEvent e )
    {
        base.OnBlur( e );
        Log.Info( "Browser panel lost focus" );
    }

    public override void OnDeleted()
    {
        base.OnDeleted();
        Log.Info( "Browser panel deleted" );
    }
}
edited 5 months ago#2
FangStriker
Member
JoinedApr 2026 Posts9 Score343
I'd like to add that I just noticed today that the 'WebBrowser' does not work in the Widget Gallery either.

Is this a known issue? Or is no one else having this issue?
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.