Skip to content

si-search-bar: standardize validation behavior #2630

Description

@chintankavathia

SiSearchBarComponent accepts a prohibitedCharacters input. When the typed term contains any of those characters, the component silently swallows the input. searchChange is not emitted
the ControlValueAccessor onChange is not called, so a bound formControl/ngModel keeps the last valid value while the DOM input shows the offending text and no visual, textual, or assistive-technology feedback is given.

The user just sees a search that stopped working with no explanation.

The component already has the styling hook for this, but it is dead code: isInvalid is hardcoded to false (si-search-bar.component.ts:127) and bound to [class.is-invalid] in the template (si-search-bar.component.html:13). It is never set to true.

The search bar should behave like the other Element form inputs: mark the field invalid and render a translatable error message.

/cc: @panch1739 @spike-rabbit

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions