Skip to content

Optional Blazor Webassembly Components #45627

@kevinasdzine

Description

@kevinasdzine

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I'd like to use Blazor webassembly components as an option in progressively enhanced websites.

  • Base level - website functions without Javascript enabled. All content is generated from server. Interaction (e.g. a filtered list) is handled with standard HTML form postbacks.
  • Enhanced level - JavaScript is enabled and browser supports webassembly . If both of these are true, Blazor components are loaded to replace standard HTML forms mentioned above to provide an enhanced UI.

However, as far as I can tell, there is no fallback feature in the current Blazor JavaScript library (i.e. if the browser doesn't support WASM, do something else) and, there doesn't appear to be a way to have the Blazor component replace existing HTML markup (or leave it intact if Blazor webassembly is not supported).

Describe the solution you'd like

  1. Enhance the Blazor JavaScript library, if necessary, to check for appropriate webassembly capability
  2. Allow the <component> element to nest standard HTML markup that is replaced by the Blazor component if it can operate. Otherwise, leave the basic HTML markup in place
<component type="typeof(EnhancedListComponent)">
  <div> <!-- this and all child content replaced by Blazor component, if it will operate -->
    <form method="get" ...> <!-- postback form -->
      <label>...</label>
      <input ... >
      .
      .
      .
    </form>
    <ul> <!-- postback driven content - i.e. paginated list -->
      .
      .
      .
    </ul>
    <div><!-- pagination controls --></div>
  </div>
</component>

Additional context

I recognize that this is a niche market. The intended use-case is for non-profit, government, or NGO information websites where compatibility and accessibility for all possible visitors are a requirement before a "pretty" UI. However, if a visitor's browser supports it, I'd like to drop in a more capable client-side UI where appropriate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-blazorIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssembly

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions