Skip to content

Blazor UI defect patterns

This page lists defects that have recurred in ConnectSoft Blazor shells, micro-frontends and UI templates. Each pattern names the symptom you see, the cause, what to look for in a review, and the test that catches it. The rules these patterns break are on the Blazor standard, the accessibility and RTL standard and the responsive layout standard.

Many of these defects pass every component test. They show only with a real circuit, a real HTTP call, a role with fewer rights, data that already exists, a phone-width viewport or the other theme. Test the page the way a user reaches it, not only the component in isolation.

Forms and saves

CS-DP-UI-001: Double click runs a save handler twice

Severity: blocker · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

Two identical requests leave a few milliseconds apart. The result is a duplicate record, or a conflict on a versioned record that the form then hides.

Cause

On Blazor Server the second click is dispatched while the first handler awaits its HTTP call. A disabled binding reaches the browser only after the first await yields, so it does not guard the handler.

Check

An @onclick or OnValidSubmit handler that writes, without a synchronous re-entry flag that is checked first and released in finally.

Test

  • A bUnit test holds the first request open with a gated HTTP handler, clicks twice and asserts that one request was sent.
  • A second test shows that disabled alone still sends two requests.

CS-UI-001

CS-DP-UI-002: Form accepts a field that no request carries

Severity: blocker · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

The form closes with a success message, and the value the user entered, such as an initial password on an edit form, never takes effect.

Cause

The field is bound in the form, but the request built on save has no property for it, or no server route can change it. The confirmation describes something that did not happen.

Check

Trace each input to the request object. A bound field with no request property, or with no route that accepts it, is the defect.

Test

A component test asserts that the field is absent on that path and that the form explains what the user can do instead.

CS-UI-007, CS-UI-019

CS-DP-UI-003: Edit form writes back nulls for fields it does not hold

Severity: blocker · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

Saving an edit form without changes clears stored fields that the user never saw.

Cause

The client view model lacks fields that the server's full-replace update assigns unconditionally. The prefill leaves them empty, and the save writes null. CS-DP-API-004 describes the same loss in the gateway mapping.

Check

An edit form over a full-replace update whose view model or mapping omits any field the update assigns.

Test

Read a fully populated record, open its editor, save without changes, read it again and assert that no field changed.

CS-UI-009, CS-API-007, CS-API-008

CS-DP-UI-004: Prefill spelled differently from the option values selects nothing

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

An edit form opens with a dropdown on no selection, or a test selector on a data attribute matches nothing, although the record has a value.

Cause

The client mapper camel-cases enum values from the wire, while option values, lookup keys and test ids use the member names. A unit test that feeds the member name directly passes.

Check

Where enum strings cross the client mapper, the casing is normalised once, and option values, lookups and test ids use the same spelling.

Test

A component test fed a captured wire payload asserts that the stored option is selected.

CS-API-004, CS-UI-009

CS-DP-UI-005: Select renders blank for a stored value outside its options

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

A select shows an empty value for seeded or older records, and saving the form can overwrite the stored value.

Cause

The stored value is not in the option list, so the browser shows no selection and binds the first option or nothing.

Check

A select bound to a free-text or historically valued column with a fixed option list.

Test

Render the component with a stored value outside the list, and assert that it is displayed as its own option and kept on save.

CS-UI-026

CS-DP-UI-006: Picker options and stored value live in different id spaces

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

An owner picker opens blank, and saving the form would re-assign the record. A "my items" list shows other people's items.

Cause

The options are built from one identifier space, such as employee ids, while the stored value or the filter uses another, such as user ids. Nothing matches.

Check

Pickers and "mine" filters whose option values and stored field come from different sources.

Test

An edit test asserts that the current owner is preselected and kept on save.

CS-AUZ-008, CS-UI-020

CS-DP-UI-007: Client validates the changed fields, server validates the resulting record

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

Editing one field of an older record returns a raw server validation message about a field the user did not touch.

Cause

The form validates only the fields the user touched, while the server validates the whole resulting record. Seeded or older rows already break a rule that the add path enforces.

Check

An edit form whose validator differs from the server validator for the same record.

Test

Edit a record seeded in the invalid state, and assert that the form reports the same rule the server applies, before the save.

CS-UI-008, CS-VAL-010

CS-DP-UI-008: Conditionally required field is not marked required

Severity: minor · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

A field becomes mandatory after another choice, the form shows no required marker, and the save is refused.

Cause

The server validator has a When(...) rule, while the form's marker and pre-save check use a fixed predicate.

Check

Each conditional server rule has one client predicate that drives both the marker and the pre-save check.

Test

Choose the value that triggers the rule, and assert that the marker appears and that the save is blocked in the client with the field named.

CS-VAL-010, CS-UI-018

CS-DP-UI-009: Refused call falls into the offline fallback and reports success

Severity: blocker · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

A refused save closes the modal and shows success, or a page shows sample data that looks live.

Cause

EnsureSuccessStatusCode turns a 401, 403 or 422 into the same exception as an outage, and the catch block serves or writes fallback data.

Check

A catch (HttpRequestException) that substitutes fallback data without checking StatusCode, which separates an answered refusal from an unreachable server.

Test

A component test makes the client return 403, and asserts that an error is shown and that nothing is written to the fallback store.

CS-UI-017, CS-ERR-001

Gates and pickers

CS-DP-UI-010: UI offers an action the server will refuse

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

  • A user fills in a whole form, or reaches it by URL, and learns only on save that their role may not do it.
  • A button is enabled while a sibling with the same precondition is disabled.
  • A required picker is empty because its lookup route answers 403 for that role.

Cause

The button, the route and the form are gated by a different predicate than the server's policy or business rule, or by none. A missing gate on one responsive branch is accepted because the other branch looks gated.

Check

  • Each new button, menu entry, route and required picker is gated by the same capability or business predicate that the API enforces, in every responsive branch.
  • Every lookup the form needs is readable by every role that sees the form.

Test

An end-to-end test as the lowest-privilege role asserts that the action and the route are withheld, paired with a role that sees and completes the action.

CS-UI-018, CS-UI-007, CS-UI-020, CS-AUZ-001, CS-A11Y-013

CS-DP-UI-011: One act gated at one entry point and open at another

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

A user fills in a form that the server can only refuse, reached through a picker, a quick action or a deep link.

Cause

The main button checks readiness, while a second entry point to the same act checks a different condition, or none.

Check

For each gated act, search every route and picker that hosts it for the same predicate name.

Test

An end-to-end test opens each entry point in the not-ready state and asserts that the act is withheld with a reason.

CS-UI-018, CS-A11Y-009

CS-DP-UI-012: Picker offers people who can no longer act

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

An assignee picker lists people who have left and accounts without a profile. The record saves with an owner who can never sign in.

Cause

The roster is joined with the people directory for display names only, and the status in the joined row is never read. The account lock state does not carry that fact.

Check

  • Pickers that feed an owner field filter on eligibility at one shared server source.
  • The filter fails safe: it fetches the excluded set, so a directory outage excludes nobody instead of emptying the picker.

Test

Seed one person who has left and one on leave, and assert that the first is absent and the second present in every picker fed by the roster.

CS-UI-020

CS-DP-UI-013: Export control produces a different artifact than the view beside it

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

The export button on a filtered list downloads a report of the whole data set, and the file's counts disagree with the page.

Cause

The button calls a report endpoint without parameters instead of the list's own search with its filters.

Check

Export handlers pass the page's current filters, and the label says what the file contains.

Test

Apply a filter, export, and assert that the file's rows match the page total.

CS-UI-019

Rendering, state and the circuit

CS-DP-UI-014: Boolean-bound ARIA state renders empty or absent

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

A screen reader cannot tell which tab, chip or toggle is selected, and ToHaveAttributeAsync("aria-selected", "true") fails on a visibly selected item.

Cause

Blazor renders an attribute bound to true as an attribute without a value and omits it for false, so aria-selected="@isSelected" never emits the strings ARIA expects.

Check

An aria-* state attribute (selected, expanded, pressed, checked, current) bound to a bool instead of @(isSelected ? "true" : "false").

Test

A component or end-to-end test asserts "true" on the selected item and "false" on an unselected sibling.

CS-A11Y-006, CS-A11Y-008

CS-DP-UI-015: Month or week input change never reaches the component

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

The input shows the chosen value, the bound property keeps its default, and the only trace is a browser page error Invalid element type 'text'.

Cause

Blazor detects a time-based input from the type attribute but normalises the value by the type property. A browser without month or week support reports text, the listener throws, and the event never reaches .NET.

Check

  • <input type="month"> or type="week" in markup.
  • End-to-end tests that fill a date input but never assert the effect on the server side.

Test

An end-to-end test on Firefox and WebKit changes the control and asserts the bound effect, with a pageerror listener that fails the test.

CS-A11Y-011

CS-DP-UI-016: Razor comment inside an open tag crashes the circuit

Severity: blocker · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

Opening a modal or a page branch ends the whole circuit with an error that the component "does not have a property matching the name '@*…'".

Cause

A Razor comment written between a component's attributes is parsed as an attribute name. Component tests that render the component directly never run the faulty call site.

Check

A Razor comment line while an element or component tag is still open.

Test

Render the page, click through to the branch that hosts the component, and assert that its root data-testid appears.

CS-UI-015

CS-DP-UI-017: Component callback invoked off the dispatcher after ConfigureAwait(false)

Severity: blocker · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

The circuit fails with "The current thread is not associated with the Dispatcher" after a real save. Tests with mocked clients never show it.

Cause

A component awaits a real HTTP call with .ConfigureAwait(false) and then invokes an EventCallback or StateHasChanged from a thread-pool thread. A mock that completes synchronously never leaves the dispatcher.

Check

.ConfigureAwait(false) in component or modal code followed by a callback, StateHasChanged or a field that the render reads.

Test

A test with a client that completes asynchronously asserts that the callback fires without a dispatcher error.

CS-UI-005, CS-ASY-002

CS-DP-UI-018: Overlapping reloads: the last answer wins the screen

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

The pager jumps back to page 1, or stale rows appear, after a quick sequence of filter changes or after a run that reloads the list.

Cause

Several loads start a keystroke apart, and each writes its results and the loading flag when it finishes, so an older load can overwrite the newest one.

Check

Pages with two or more @bind:after reloads, or a run that triggers a reload, with no load ticket that guards the writes.

Test

A component test completes two loads out of order and asserts that only the latest result is shown.

CS-UI-011, CS-ASY-007

CS-DP-UI-019: Event modifier bound to a flag set in its own handler lags one event

Severity: minor · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

A masked input lets a rejected key through and blocks the next valid one.

Cause

@onkeydown:preventDefault is bound to a field that the keydown handler sets. The browser applies the value from the previous render, because the decision is made before the .NET handler runs.

Check

:preventDefault or :stopPropagation bound to state that the same event's handler changes.

Test

A browser test types an invalid and then a valid character and asserts the resulting value.

CS-UI-029

CS-DP-UI-020: Per-user storage key read before the user id hydrates

Severity: minor · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

A remembered selection, such as the chosen warehouse, is not restored after a reload, although it is in browser storage.

Cause

The storage key includes the user id, which is not known at the first render. The one-time restore reads the anonymous key, finds nothing and never runs again. Later state re-initialisations also re-apply the default.

Check

Browser-storage reads keyed by the user's identity in OnAfterRenderAsync(firstRender), with no new read when the key or the state changes.

Test

A browser test stores a choice, reloads with delayed claims hydration and asserts that the choice is active.

CS-UI-004, CS-UI-027

CS-DP-UI-021: Restore of a refused remembered choice retries forever

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

A menu option is present and checked, but a click on it never completes, and the page chrome re-renders continuously.

Cause

A remembered value that the user may not use is re-applied on every state change. Each refusal changes state again, so the control never settles.

Check

Restore logic that retries after a refusal instead of clearing both the field and the stored value.

Test

Store a choice that is valid for an administrator, sign in as a user with a narrower scope, and assert that the stored value is cleared and the page settles.

CS-UI-027

CS-DP-UI-022: AsyncLocal holder cleared in place erases the value for suspended continuations

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

Only the first authenticated call of a page carries a bearer token. Later calls on the same page go out anonymous and are refused.

Cause

A circuit-scoped accessor stores a mutable holder in AsyncLocal and sets the holder's value to null on clear. Execution contexts that were already copied share the holder, so they lose the value too.

Check

An AsyncLocal<Holder> whose setter changes the existing holder instead of assigning a new value.

Test

An accessor test publishes a value, awaits, clears it from the publisher, and asserts that the continuation still reads the value.

CS-ASY-007, CS-UI-028

CS-DP-UI-023: Static initialiser reads a field declared further down

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

The first use of a static helper class throws TypeInitializationException.

Cause

Static field initialisers run in declaration order, so a derived table built from a field declared later reads null.

Check

A static readonly field initialised from another static field of the same class that is declared below it.

Test

A unit test uses the class and resolves a value through the derived table.

CS-STY-012

CS-DP-UI-024: Health probe path collides with a page route

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

GET /health answers 500 with AmbiguousMatchException, while the build and the unit tests pass.

Cause

The host maps the probe endpoint at the same path that a composed page declares with @page, so routing finds two candidates.

Check

  • A new @page or endpoint path equal to a probe path in the deployment values.
  • Probes on generic paths such as /health in UI hosts.

Test

  • A route-uniqueness test over all endpoints and pages.
  • A run-time probe of every page and health path in the shell.

CS-UI-025

Language, dates and text

CS-DP-UI-025: Instants become calendar days in the wrong time zone

Severity: blocker · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

  • Events recorded just after local midnight show the previous day or month.
  • Two adjacent dates on one screen differ by a day.
  • Month-based business rules misfire in the first hours of each month.

Cause

  • Instants are formatted with their UTC parts, converted with ToLocalTime(), which does nothing on a host that runs in UTC, or turned into a date string in the client mapper before the formatter runs.
  • Server rules compare a locally stamped day with a UTC clock.
  • The opposite error also occurs: a calendar day stored at UTC midnight is converted as if it were an instant.

Check

ToString("dd/MM/yyyy") or "yyyy-MM-dd" on instants, ToLocalTime(), TimeZoneInfo.Local and UtcNow.Date defaults. Classify each value as an instant or a calendar day, and convert only instants, through one configured time zone.

Test

  • Formatter and rule tests with an instant just after local midnight, in a configured time zone whose offset differs from the test host's.
  • A round-trip test of a calendar day.

CS-A11Y-003, CS-TIM-003

CS-DP-UI-026: Validation refusals bypass the error-code translation

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

Users read PropertyName: English sentence or The X field is required. on a localised form, while domain refusals are translated.

Cause

  • Translation is keyed on the ProblemDetails errorCode, but model-validation 400 responses carry only an errors dictionary.
  • DataAnnotations sentences already contain the field name, so a gateway that removes repeated names drops the key the client matches.
  • A response without a ProblemDetails body leaves nothing to translate.

Check

The client's refusal translator handles validation dictionaries, framework DataAnnotations sentences and empty bodies, and matches the key that the producer really sends.

Test

One case per kind of refusal (FluentValidation, DataAnnotations, an empty 403, 404 or 409, and a domain errorCode) asserts that the text is in the user's language.

CS-A11Y-007, CS-API-005

CS-DP-UI-027: Renderer translates named columns only, so other coded values leak raw

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

Report cells, group headings or warning strips show internal codes or English placeholders such as Pending or unassigned on a page in the user's language.

Cause

The renderer translates a fixed list of column keys. Every other coded column, placeholder group key and warning token falls through to the raw value.

Check

  • Display code that switches on column names instead of a lookup name declared per column.
  • Placeholder or token values rendered without a resource lookup.

Test

A test over the whole report catalogue renders every report and asserts that no coded column or warning shows a raw code.

CS-A11Y-007, CS-A11Y-020

CS-DP-UI-028: Count text built by interpolation ignores plural forms

Severity: minor · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

Text such as "1 days ago" appears with live data, in a language with singular, dual or plural forms.

Cause

The text is built with $"{count} days" instead of a resource lookup that selects the plural form.

Check

Interpolated numbers next to localised nouns.

Test

A unit test of the text helper for 1, 2 and many, in each supported culture.

CS-A11Y-007

Layout, theme and responsive

CS-DP-UI-029: Responsive twin lacks a control or its explanation

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

The phone list ends after one page with no pager, or a disabled control on the phone shows no reason.

Cause

A pager, banner or warning lives inside the desktop-only branch, while the list or the state it governs renders in both branches.

Check

Controls and explanations inside one responsive branch when the list or state they govern renders in both.

Test

A phone-width test, scoped to the phone panel's own subtree, asserts that the control and its explanation are present.

CS-A11Y-013

CS-DP-UI-030: 1fr grid track overflows off the edge, unseen by scroll checks

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

At phone width, values next to a chart are missing, clipped off the left edge in a right-to-left layout, while tests that the page does not scroll sideways pass.

Cause

1fr means minmax(auto, 1fr), so a wide child keeps the track at its minimum content width and the track overflows its container. The overflow is clipped, so scrollWidth does not grow.

Check

grid-template-columns with a bare 1fr for a track that holds wide content.

Test

At phone width, assert that each element's bounding box lies inside the viewport, with test data wide enough to reproduce the overflow.

CS-A11Y-002

CS-DP-UI-031: Phone layout pushes a control past an overflow-hidden edge

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

At phone width a control or badge is rendered but out of reach beyond the screen edge, while tests that check only visibility still pass.

Cause

A flex row that does not wrap is wider than its column, or a flex item sized flex: 0 0 auto has long content. The main column clips the overflow with overflow-x: hidden, so the element still counts as visible.

Check

New flex rows without flex-wrap: wrap, and fixed-basis flex items without a max-width and overflow-wrap, in markup that renders at phone width.

Test

A phone-width browser test asserts that each key control's bounding box lies within the viewport width.

CS-A11Y-012, CS-A11Y-021

CS-DP-UI-032: Flex basis becomes a height when a row turns into a column

Severity: minor · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

At phone width an input renders as a tall box, for example 180 px high.

Cause

flex: 1 1 180px was written for a horizontal row. A breakpoint switches the container to flex-direction: column, so the basis now sets the height.

Check

A pixel flex-basis on an item whose container gets flex-direction: column in any media query.

Test

A phone-width browser test asserts that the input's height stays under a small bound, for example 60 px.

CS-A11Y-021

CS-DP-UI-033: Breakpoint helper overrides a component's own display

Severity: minor · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

A phone-only strip that should be one flex row renders as stacked blocks.

Cause

The phone-only helper class sets display: block !important, which overrides the component's flex or grid display.

Check

New phone-only blocks that need flex or grid, without a matching rule inside the media query that restores it.

Test

A real-browser test at phone width asserts the computed display or the row geometry.

CS-A11Y-019

CS-DP-UI-034: Kit components render unstyled because the scoped CSS bundle is not linked

Severity: major · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

Components from a package lose their layout. For example, skeleton rows collapse into one block.

Cause

App.razor does not link <Assembly>.styles.css, which imports the scoped CSS of every package.

Check

An application host without the link to the scoped CSS bundle.

Test

A browser test asserts the computed display of a component from the package.

CS-A11Y-018

CS-DP-UI-035: Element styled by a class that does not apply

Severity: minor · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

A button renders as bare text, or a populated cell looks empty because its text has the same colour as its background.

Cause

The markup uses a class that no stylesheet defines, or a class written for the other surface, such as a phone card's light text inside a desktop table.

Check

  • Classes in new Razor files that the theme does not define.
  • Phone-only classes used outside phone-only containers.

Test

Compare the computed style with a known-good instance, or use a source-scan test that every class with the theme prefix is defined.

CS-A11Y-016

CS-DP-UI-036: Hard-coded colours bypass the theme tokens

Severity: minor · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

In dark mode a tile or label renders white on white, or keeps a light background.

Cause

Some rules set literal colours, while the text colour follows the theme variable, so only one half of a contrast pair switches.

Check

Literal colour values in component or theme CSS where a token exists.

Test

A computed-style check in both themes asserts that the background and the text come from tokens and have enough contrast.

CS-A11Y-016, CS-A11Y-017, CS-A11Y-022

CS-DP-UI-037: Sibling buttons touch after a conditional block

Severity: nit · Applies to: blazor, template · Enforced by: manual · Status: active

Symptom

Action buttons in a table cell sit 0 px apart on some rows.

Cause

The spacing relied on whitespace in the markup between siblings, and Razor emits no whitespace after an @if { } block.

Check

Adjacent inline controls separated only by whitespace, where any of them is inside a conditional block.

Test

A layout test measures the gap between action buttons with the conditional button shown.

CS-A11Y-023