Giter VIP home page Giter VIP logo

admiralty-design-system's Introduction

ADMIRALTY Design System

Open in GitHub Codespaces

This repository contains the source for the ADMIRALTY Design System, our library of UI components that is used in our front end designs. We make use of Web Component technology to produce components that can be used across multiple frameworks, each framework has its own package.

Framework Package Notes
HTML/CSS/JS @ukho/admiralty-core
Source
npm
Angular @ukho/admiralty-angular
Source
npm
Other @ukho/admiralty-core
Source
npm
Although untested, you can use @ukho/admiralty-core with any framework that supports HTML custom elements

Contributing

Currently we are not accepting contributions to this repository. You can read the UKHO's Open Source Policy here

admiralty-design-system's People

Contributors

aljhill avatar dependabot[bot] avatar ecstaticrainbow avatar github-actions[bot] avatar lstevens98 avatar tellyzap avatar ukhogreg avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

admiralty-design-system's Issues

[Feature] admiralty-input - admiralty-input-error to be hidden to allow custom validation

As you can see in the image provided, we need to have the ability to render a custom error input that spans across both inputs, however the admiralty-input-error is still visible in the HTML of admiralty-input and can cause spacing issues when doing this. (Causes the custom validation to be rendered to far away from the actual input, due to the space being reserved)

What I suggest (unless there is an alternative way) is to have the option to set a flag to true or false in order to have it save the space for standard validation or to remove the space to allow custom validation. eg: [custom-validation]="true" || [custom-validation]="false". (feel free to change the name to something more appropriate)

          <div formGroupName="surveyDateRange" class="level pt-4">
            <div class="level-item is-justify-content-left mr-4">
              <admiralty-input formControlName="startDate"
                               [label]="'Start Date *'"
                               [name]="'Start Date'"
                               [invalid]="isStartDateInvalid()"
                               [invalidMessage]="validateStartEndDates(form.controls.surveyDateRange, 'startDate')"
                               class="is-full-width"
                               type="date"></admiralty-input>
            </div>
            <div class="level-item is-justify-content-right ml-4">
              <admiralty-input formControlName="endDate"
                               [label]="'End Date *'"
                               [name]="'End Date'"
                               [invalid]="isEndDateInvalid()"
                               [invalidMessage]="validateStartEndDates(form.controls.surveyDateRange, 'endDate')"
                               class="is-full-width"
                               type="date"></admiralty-input>
            </div>
          </div>

image
image

[BUG] admiralty-header-menu-item admiraltychange event not working

The admiralty-header-menu-item admiraltychange event is not being triggered at all.

<admiralty-header alt="UK Hydrographic Office"
                  [ngClass]="(isAuthenticated | async) ? '' : 'header'"
                  [title]="header.title"
                  [logoImgUrl]="header.logoImgUrl"
                  [logoLinkUrl]="header.logoLinkUrl"
                  [logoAltText]="header.logoAltText"
                  [headerTitle]="header.title">
  <ng-container *ngFor="let item of headerItems">
    <admiralty-header-menu-item [hidden]="!(isAuthenticated | async)"
                                [menuTitle]="item.title"
                                (admiraltychange)="navigate(item.routerLink)"
                                [slot]="'items'"></admiralty-header-menu-item>
  </ng-container>
  <admiralty-header-profile [isSignedIn]="(isAuthenticated | async)"
                            (signOutClicked)="this.logout()"
                            [signedInText]="(fullname | async)"
                            [hidden]="!(isAuthenticated | async)"
                            aria-label="Sign in"
                            class="profile"
                            slot="profile"></admiralty-header-profile>

image

[BUG] admiralty-button doesn't copy attributes

Describe the bug

<admiralty-button> doesn't copy name or value attributes, breaking buttons

To Reproduce
Steps to reproduce the behaviour:

  1. Add <admiralty-button name="test" value="hello">Hello</admiralty-button> to a page

Expected behaviour
The generated button to include the name and value, so that when the parent form submits it includes the name/value in the payload

Additional context
Dealbreaking bug

[Feature] Skip link, no skip link fails WCAG 2.4.1

Level A 2.4.1 - A mechanism is available to bypass blocks of content that are repeated on multiple Web pages.
There should be a method for keyboard only users to skip content that is repeated on multiple Web pages.
There should be a skip link at the top of the page to the main content of the page as the header is repeated across all the sites pages.

[BUG] admiralty-select & admiralty-input styling alignment

Place the two components side by side and you can see the styling differences. Can this be aligned correctly please?

          <div style="display: flex">
            <admiralty-select style="margin-right: 10px; width: 250px"
                              [label]="'Vertical datum *'">
              <option disabled></option>
              <option>test</option>
              <option>test 2</option>
            </admiralty-select>
            <admiralty-input style="margin-right: 10px; width: 250px"
                             [label]="'Please give further details:'"></admiralty-input>
          </div>

image

Make story to alter padding inside button [Feature]

Is your feature request related to a problem? Please describe.
There needs to be more flexibility in our CTA buttons. The ability to pass smaller and also full width versions would be useful

Describe the solution you'd like
Reduce padding inside button from 18 to 8px. Create version with bespoke padding right / left

Describe alternatives you've considered
none sought

Additional context
Add any other context or screenshots about the feature request here.

[Feature] admiralty-radio-group to have a conditional revealing input

Require a conditional revealing input on radio options similar to the GDS library (Links provided below). This is required as we have an issue with a formControlName being nested within this component, which overrides the parent formControlName, leading to the value not being maintained, which can be seen here below

image

  <admiralty-radio-group formControlName='dataInterpolated' <!--This value gets overwritten by dataInterpolatedOther when typing within the input, which removes the selected option value-->
                         displayVertical="true"
                         (admiraltyChange)="onDataInterpolatedChanged($any($event.target).value)"
                         [name]="'dataInterpolated'">
    <admiralty-radio [value]="true"
                     name="dataInterpolated">Yes</admiralty-radio>
    <admiralty-input *ngIf="selectedDataInterpolated !== 'false' && selectedDataInterpolated !== ''"
                     formControlName="dataInterpolatedOther"
                     class="radio-label"
                     [label]="'Please give further details:'"></admiralty-input>
    <admiralty-radio [value]="false"
                     name="dataInterpolated">No</admiralty-radio>
  </admiralty-radio-group>

GDS Radio component: https://design-system.service.gov.uk/components/radios/
GDS Radio component design: https://design-system.service.gov.uk/components/radios/conditional-reveal/index.html

[Feature] PowerBI Dashboard theme template (we've already made it - should/could we add it here)

The data analysis team often makes PowerBI dashboards.
They have created a json file for the colours and fonts to fit the corporate style guide to re-use.

Would this be worth adding here? Or would it be best to keep it separate?

As an aside there are other dashboarding technologies that are used by data science and data analytics can use this format but PowerBI is the primary one used by Analytics.

[BUG] Phase banner feedback link needs to be underlined

The feedback link fail WCAG 2.1:
Level A 1.4.1 - Colour is not used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element. F73: Failure of Success Criterion 1.4.1 due to creating links that are not visually evident without colour vision

The 'feedback' link in the phase banner only gives one visual indication that they are links (blue text). They need to be underlined or underline on hover to conform to WCAG 1.4.1.

image

[Feature] admiralty-file-input - Implement validation

Implement validation for the file input.

The scenario we are trying to complete is where specific file type(s) are prevented from being selected or allowed to be selected but an error appears

          <admiralty-file-input id="file-input" multiple label="Select file or drag it here" (fileInputChange)="populateFiles($event)"></admiralty-file-input>

image

[Feature] Add protected branch plugin for auto

Is your feature request related to a problem? Please describe.
Currently main branch is not protected from pushes in order for auto to work.
By adding this plug-in we can protect the main branch without breaking auto.

Describe the solution you'd like
Add protected branch plug-in for auto.

[BUG] admiralty-progress-bar is not updating when using the async pipe

The admiralty-progress-bar is not updating when using the async pipe.

uploadFiles(): void {
    this.fileInfos$.pipe(
        map((files) => {
            files.forEach(x => x.progress = 100)
        })
    ).subscribe((re) => {
        console.log(re)
    })
}

populateFiles(event: AdmiraltyFileInputCustomEvent<FileInputChangeEventDetail>): void {
    const files: File[] = event.detail.files as File[];

    Array.from(files).map((file) => {
        fileInfos.push({
            file: file,
            fileName: file.name,
            fileSize: file.size,
            progress: 0,
        });
    });

    this.fileInfos$ = of(fileInfos);
}
<div>
          <admiralty-file-input id="file-input" multiple label="Select file or drag it here" (fileInputChange)="populateFiles($event)"></admiralty-file-input>

  <div class="tile" *ngIf="(fileInfos$ | async) as files">
      <admiralty-table *ngIf="files.length > 0" class="custom-table">
          <admiralty-table-header>
              <admiralty-table-header-cell class="column-status">Status</admiralty-table-header-cell>
          </admiralty-table-header>
          <admiralty-table-body>
              <admiralty-table-row *ngFor="let item of files; let i = index">
                  <admiralty-table-cell>
                      {{item.progress}}
                      <admiralty-progress-bar  [progression]="item.progress"></admiralty-progress-bar>
                      <progress id="file" value="{{item.progress}}" max="100"> {{item.progress}} </progress>
                  </admiralty-table-cell>
              </admiralty-table-row>
          </admiralty-table-body>
      </admiralty-table>
  </div>
  <admiralty-button variant="primary"
                    (click)="uploadFiles()"
                    type="button">Upload and send survey</admiralty-button>
</div>

image

Tried this without async a day later and still no luck.

image

[BUG] admiralty-select option tag will not append the disable attribute when within the web component

Describe the bug
We cannot add a disabled option within the admiralty-select web component, as soon as it renders on the UI it completely removes the attribute and is therefore selectable

we need a default blank select option that can't be reselect once the user focuses on the select.

`<admiralty-select formControlName="purpose"
                            [hint]="'This helps us understand where to focus when processing your data'"
                            [label]="'Primary purpose of data collection *'">
  <option disabled></option>
  <ng-container *ngFor="let item of purposes">
    <option>{{item.purpose}}</option>
  </ng-container>
</admiralty-select>`

image

[BUG] Accessibility: Admiralty Logo fails WCAG 1.1.1, 2.5.3

Describe the bug
The ALT description for the Admiralty logo is currently "Admiralty Stacked Logo" which does not sufficiently describe its purpose or include all the text visible in the image.

Expected behavior
My thoughts are the preferred solution would be to change the Admiralty Logo and UK Hydrographic Office Logo to be link elements with either 'Admiralty Maritime Data Solutions' or 'UK Hydrographic Office' as its text. They can be styled to look as they currently do with CSS and any icons being an SVG element that's non-focusable.

But at a minimum to pass WCAG the ALT text for the Admiralty logo will need to be change to 'Admiralty Maritime Data Solutions | UK Hydrographic Office'. As there are multiple links to the same destination on a page, Admiralty Logo in the header and UK Hydrographic Office Logo in footer they should have the same description.

Screenshots
image

Additional context
Level A 1.1.1 - All non-text content that is presented to the user has a text alternative that serves the equivalent purpose.
F30: Failure of Success Criterion 1.1.1 and 1.2.1 due to using text alternatives that are not alternatives (e.g., filenames or placeholder text)
Level A 2.5.3 - If the non-text content is an image of text, then the name contains the text that is presented visually.
F96: Failure due to the accessible name not containing the visible label text.

[BUG] admiralty-radio-group is missing invalid and invalid message attributes for validation

Invalid and Invalid message attributes for validation are not available, can this be implemented please?

  <admiralty-radio-group *ngIf="(coordinateTypes$ | async) as coordinates"
                         formControlName='coordinateTypeSelected'
                         [invalid]="dataCollection.coordinateTypeSelected.invalid && dataCollection.coordinateTypeSelected.touched"
                         [invalidMessage]="validate(dataCollection.coordinateTypeSelected, 'Coordinate type')"
                         displayVertical="true"
                         (admiraltyChange)="onCoordinateTypeChange($any($event.target).value, coordinates)"
                         name="coordinateType">
    <ng-container *ngFor="let item of coordinates">
      <admiralty-radio [id]="item.coordinateType"
                       name="coordinateType"
                       [value]="item.coordinateType">{{item.coordinateType}}</admiralty-radio>
    </ng-container>
  </admiralty-radio-group>

Make whole of colour block clickable [Feature]

Is your feature request related to a problem? Please describe.
Users need to have obvious CTA in colour block, Team kai have completed user testing showing whole block should be clickable

Describe the solution you'd like
Use Team Kai implementation

Describe alternatives you've considered
Add icon to text link, but whole block click most useful

Additional context
Add any other context or screenshots about the feature request here.

[BUG] admiralty-type-ahead-item fails to append "value" on dynamic data regardless of whether its set locally or from an API

Whenever i try to render dynamic data whether it be an array of type set locally or fetching data from an API to then render using observables, the admiralty-type-ahead-item fails to append the value

<admiralty-type-ahead resultsOnInitFocus="true"
                                      type="text"
                                      [label]="'Commissioning organisation *'">
  <ng-container *ngFor="let item of commissioningOrganisations$ | async" >
    <admiralty-type-ahead-item [value]="item.organisationName"></admiralty-type-ahead-item>
  </ng-container>
</admiralty-type-ahead>
commissioningOrganisations$: Observable<CommissioningOrganisation[]>;

export interface CommissioningOrganisation {
  id?: number;
  organisationName?: string;
}

image

[BUG] admiralty-type-ahead prediction box pushes elements down instead of overlaying like the admiralty-select

admiralty-type-ahead prediction box pushes elements down instead of overlaying like the admiralty-select

<admiralty-type-ahead type="text"
                                      placeholder="Commissioning organisation"
                                      [label]="'Commissioning organisation *'">
  <ng-container *ngFor="let organisation of commissioningOrganisations$ | async" >
    <admiralty-type-ahead-item [value]="organisation.organisationName"></admiralty-type-ahead-item>
  </ng-container>
</admiralty-type-ahead>

image

[BUG] admiralty-type-ahead's overlay pushes content down instead of overlaying

When you have 2 admiralty-type-aheads the content is pushed out of line, its suppose to overlay like the admiralty-select

   <admiralty-type-ahead resultsOnInitFocus="true" 
                        formControlName="commissionOrganisation"
                        type="text"
                        [label]="'Commissioning organisation *'">
      <ng-container *ngFor="let organisation of commissioningOrganisations$ | async" >
        <admiralty-type-ahead-item [value]="organisation.organisationName"></admiralty-type-ahead-item>
      </ng-container>
  </admiralty-type-ahead>

Before type-ahead is activated via typing or cursor:
image

After type-ahead is activated via typing or cursor:
image
image

Select - add instruction text in input [Feature]

Is your feature request related to a problem? Please describe.
Accessibility requires Select component to have text to inform user to 'select an option'

Describe the solution you'd like
Follow Team Kai advice on this

Describe alternatives you've considered
None valid

Additional context
Add any other context or screenshots about the feature request here.

[BUG] admiralty-select option to use ngValue to bind objects

Can you implement ngValue on the option tags as currently its not binding the object and its only binding the string value in the dropdown, instead of the object.

  <admiralty-select *ngIf="(purposes$ | async) as purposes"
                    formControlName="primaryPurposeOfDataCollection"
                    [hint]="'This helps us understand where to focus when processing your data'"
                    [label]="'Primary purpose of data collection *'">
    <option disabled></option>
    <ng-container *ngFor="let purpose of purposes">
      <option [ngValue]="purpose">{{ purpose.purpose }}</option >
    </ng-container>
  </admiralty-select>

returns the following:

primaryPurposeOfDataCollection: "Shoal Investigation"

image

Even when I hit the event handler it returns a string:

image

when using [value] to send an object it returns "[Object Object]"

  <admiralty-select *ngIf="(purposes$ | async) as purposes"
                    formControlName="primaryPurposeOfDataCollection"
                    [hint]="'This helps us understand where to focus when processing your data'"
                    [label]="'Primary purpose of data collection *'">
    <option disabled></option>
    <ng-container *ngFor="let purpose of purposes">
      <option [value]="purpose">{{ purpose.purpose }}</option >
    </ng-container>
  </admiralty-select>

image

Now when using the standard Select it works a treat:

      <div *ngIf="(purposes$ | async) as purposes">
        <select formControlName="primaryPurposeOfDataCollection">
          <ng-container *ngFor="let purpose of purposes">
            <option [ngValue]="purpose">{{ purpose.purpose }}</option >
          </ng-container>
        </select>
      </div>

image

[BUG] Use of SCSS Variables, Mixins etc

Describe the bug
I cannot import colours variables as you could from the previous design system.

To Reproduce

  1. Install the library

You cannot find any SCSS files within the package to import variables and mixins into the main project

Expected behavior
I should be able to do something like the below but for this library:

@use '@ukho/design-system/styles/base/typography';
@use '
@ukho/design-system/styles/base/colours';

[BUG] admiralty-textarea does not support maxLength

Describe the bug
Cannot limit the characters within the text area field. I currently set ' maxlength="2" ' however I can still go over this limit.

        <admiralty-textarea [style.width]="'500'"
                                         maxlength="1024"
                                         [style.display]="'block'"
                                         [label]="'Comments on data cleaning/issues that couldn\'t be resolved *'"></admiralty-textarea>

image

[BUG] Admiralty-Select: Issues with change detection when compared to standard select element

When trying to dynamically create a reactive form to render the admiralty-select component, we have an issue where it returns an error of NG0100 which can be seen below:

image

Here is the HTML specific to the design system component but using the disableOption method:

  <admiralty-select formControlName='methodOfSurveySelected'
                    id="methodOfSurvey"
                    [invalid]="getMethodOfSurveySelected(index).invalid && getMethodOfSurveySelected(index).touched"
                    [invalidMessage]="validate(getMethodOfSurveySelected(index), 'Method of survey')"
                    class="is-full-width mr-4"
                    (admiraltyChange)="onMethodOfSurveyChange($any($event.target).value, MethodOfSurveys, index)"
                    [label]="'Method of survey' + (methodsOfSurvey.length > 1 ? ' ' + (index + 1) : '') ">
    <option disabled></option>
    <ng-container *ngFor="let methodOfSurvey of MethodOfSurveys">
      <option [disabled]="disableOption(methodOfSurvey)" [ngValue]="methodOfSurvey.method">{{ methodOfSurvey.method }}</option>
    </ng-container>
  </admiralty-select>
  public disableOption(methodOfSurvey): boolean {
    return this.unavailableMethodsOfSurvey.includes(methodOfSurvey);
  }

Here is the HTML specific to the design system component by using the getAvailableMethodsOfSurvey(index) method to mutate the data using rxjs:

  <admiralty-select *ngIf="(getAvailableMethodsOfSurvey(index) | async) as MethodOfSurveys"
                    formControlName='methodOfSurveySelected'
                    id="methodOfSurvey"
                    [invalid]="getMethodOfSurveySelected(index).invalid && getMethodOfSurveySelected(index).touched"
                    [invalidMessage]="validate(getMethodOfSurveySelected(index), 'Method of survey')"
                    class="is-full-width mr-4"
                    (admiraltyChange)="onMethodOfSurveyChange($any($event.target).value, MethodOfSurveys, index)"
                    [label]="'Method of survey' + (methodsOfSurvey.length > 1 ? ' ' + (index + 1) : '') ">
    <option disabled></option>
    <ng-container *ngFor="let methodOfSurvey of MethodOfSurveys">
      <option [ngValue]="methodOfSurvey.method">{{ methodOfSurvey.method }}</option>
    </ng-container>
  </admiralty-select>
  public getAvailableMethodsOfSurvey(index: number): Observable<SurveyMethodDto[]> {
    return this.methodsOfSurveySubject$.pipe(
      takeWhile((methods: SurveyMethodDto[]): boolean => methods !== null),
      map((methods: SurveyMethodDto[]): SurveyMethodDto[] => {
        if (
          this.unavailableMethodsOfSurvey.length > 0 &&
          this.getMethodOfSurvey(index).value !== null &&
          this.getMethodOfSurvey(index).value !== undefined
        ) {
          const availableItems: SurveyMethodDto[] = methods.filter(
            (surveyMethod: SurveyMethodDto) => !this.unavailableMethodsOfSurvey.includes(surveyMethod)
          );
          const selectedItem: SurveyMethodDto = methods.filter(
            (surveyMethod: SurveyMethodDto): boolean =>
              this.getMethodOfSurvey(index).value.method === surveyMethod.method
          )[0];
          availableItems.push(selectedItem);
          return availableItems;
        } else {
          return methods.filter(
            (surveyMethod: SurveyMethodDto) => !this.unavailableMethodsOfSurvey.includes(surveyMethod)
          );
        }
      })
    );
  }

As you can see the 2 different methods cause the issue when returning back to the component regardless of whether or not you destroy the component. The issue lies between the "Current Value" and the "Old Value" changing after the content is rendered, when using the "admiralty-select". So in both methods we have both the current value and old value, whether it be (true changing false) or (an array of 10 changing to an array of 5).

The only way I managed to supress the error was implementing the following, however its not best practice to do this as it takes a big performance hit (literally being called at every change not matter how big or small - even when you take it out of the subscribe, which I implemented to limit the times it was called):

  constructor(private cdref: ChangeDetectorRef) {}

  ngAfterContentChecked(): void {
    this.isEditing$.subscribe((isEditing) => isEditing ?? this.cdref.detectChanges());
  }

When I removed this admiralty-select component and used a standard select component we have no issues or errors, with either of the 2 methods.

  <select formControlName='methodOfSurveySelected'
                    id="methodOfSurvey"
                    class="is-full-width mr-4"
                    (change)="onMethodOfSurveyChange($any($event.target).value, MethodOfSurveys, index)">
    <option disabled></option>
    <ng-container *ngFor="let methodOfSurvey of MethodOfSurveys">
      <option [disabled]="disableOption(methodOfSurvey)" [value]="methodOfSurvey.method">{{ methodOfSurvey.method }}</option>
    </ng-container>
  </select>

We need the admiralty-select component to be able to handle changes without modifying the changeDetection strategy or using the detectChanges method.

[BUG] Heading in header component should not be a <h1>

Best practice is to use one unique h1 per page that describes what that page is about, normally the same as the page title. That h1 preferably starts just above the main content. This way it can also be used by user as a way to skip to the main content of the page.

Headings create an outline for the page, similar to a term paper outline or table of contents. The h1 describes the page as a whole (and should be similar /same as the page <title>). A page should typically have only one h1.(https://webaim.org/techniques/semanticstructure)

In my opinion the Heading should be changed to a h2.

[BUG] Nested input component within radio group overrides parent radio group form control value

Team Kai have an issue with a formControlName on an input field being nested within a radio group, which overrides the parent formControlName, leading to the value not being maintained, which can be seen here below

image

  <admiralty-radio-group formControlName='dataInterpolated' <!--This value gets overwritten by dataInterpolatedOther when typing within the input, which removes the selected option value-->
                         displayVertical="true"
                         (admiraltyChange)="onDataInterpolatedChanged($any($event.target).value)"
                         [name]="'dataInterpolated'">
    <admiralty-radio [value]="true"
                     name="dataInterpolated">Yes</admiralty-radio>
    <admiralty-input *ngIf="selectedDataInterpolated !== 'false' && selectedDataInterpolated !== ''"
                     formControlName="dataInterpolatedOther"
                     class="radio-label"
                     [label]="'Please give further details:'"></admiralty-input>
    <admiralty-radio [value]="false"
                     name="dataInterpolated">No</admiralty-radio>
  </admiralty-radio-group>

GDS Radio component: https://design-system.service.gov.uk/components/radios/
GDS Radio component design: https://design-system.service.gov.uk/components/radios/conditional-reveal/index.html

[Feature] Remove admiralty-file-input label update behaviour when files are selected

New Issue

Remove admiralty-file-input label update behaviour when files are selected.

This behaviour is not wanted for all use cases.

Restoring the behaviour

If our users want to list the files in the label, they can restore that behaviour.

We emit the fileInputChange event as FileInputChangeEventDetail which contains the list of files.

Our users can listen to that event and can set the label property of the FileInput with something similar to this:

label = `${this.files[0].name} (${this.sizeOf(this.files[0].size)}) ${this.files.length > 1 ? ' ...' : ''}`;

Original Issue

Prior to selecting a file we see Select file(s), but having selected a number of files, the name changes and is displayed in a weaker font. Can we have a way for the label to be maintained throughout the selection of files please.

<admiralty-file-input id="file-input" multiple label="Select file(s)" (fileInputChange)="populateFiles($event)"></admiralty-file-input>

before:
image

after:
image

[BUG] admiralty-input - validation: max length does not work

Max length is not limiting the characters put into the field.

(If possible can the Min Length be checked when doing this one please)

          <admiralty-input formControlName="surveyTitle"
                           type="text"
                           [label]="'Survey Title *'"
                           [name]="'Survey Title'"
                           [invalid]="form.controls.surveyTitle.invalid && form.controls.surveyTitle.touched"
                           [invalidMessage]="validate(form.controls.surveyTitle, 'Survey Title')"
                           maxLength="10"
                           [hint]="'We will use this to refer to the survey in communication with you'"></admiralty-input>

image

[BUG] admiralty-dialogue displaying the warning icon in the wrong place

There is some misalignment with the admiralty-dialogue component heading and warning icon.

        <admiralty-dialogue  type="warning">
          <h3>Have you uploaded all digital data for this survey?</h3>
          <div>Ensure you've attached all files with this survey as we might be unable to process this without all the digital information.</div>
        </admiralty-dialogue>

image

[BUG] admiralty-radio-group allows you to click between the radio and label but not update the radio itself to be selected

admiralty-radio-group allows you to click between the radio and label which results in the change event being triggered but not updating the radio itself to be selected. Please see code and images below:

<admiralty-radio-group formControlName='reductionOfSounding'
                       displayVertical="true"
                       (admiraltyChange)="onReductionOfSoundChanged($any($event.target).value)"
                       [name]="'reductionOfSounding'">
  <p class="sub-element-title">Reduction of sounding to datum method *</p>
  <admiralty-radio value="Predicted Tides"
                   name="reductionOfSounding">Predicted Tides</admiralty-radio>
  <admiralty-radio value="Observed Tides"
                   name="reductionOfSounding">Observed Tides</admiralty-radio>
  <admiralty-radio value="Other"
                   name="reductionOfSounding">Other</admiralty-radio>
</admiralty-radio-group>
<admiralty-input *ngIf="form.controls.reductionOfSounding.value === 'Other'"
                 formControlName="reductionOfSoundingOther"
                 class="radio-label"
                 [label]="'Please give further details:'"></admiralty-input>

Before selecting gap between radio and label for "Observed Tides"
image

After selecting gap between radio and label for "Observed Tides"
image

As you can see, the event was trigged and the form value has been updated to "Observed Tides" however the radio is not selected for "Observed Tides"

[BUG] admiralty-textarea needs control value accessor applied

The admiralty-textarea component allows you to type values but for some reason you cannot fetch the value through form controls

  <admiralty-textarea formControlName='dataCleaningComments'
                      [style.width]="'500'"
                      maxLength="1024"
                      [style.display]="'block'"
                      [hint]="'This helps give context to anything that might look unusual in the data'"
                      [label]="'Comments on data cleaning/issues that couldn\'t be resolved *'"></admiralty-textarea>
<span>{{ form.controls.dataCleaningComments.value }}</span>

image
image

[BUG] admiralty-input - validation: display's exclamation mark when invalid message is not provided

We need to be able to render custom validation as mentioned in my feature request, so we need to hide the exclamation mark when text is not provided or the attribute is not provided.

  <div class="level-item is-justify-content-right ml-4">
    <admiralty-input formControlName="endDate"
                     [label]="'End Date *'"
                     [name]="'End Date'"
                     [invalid]="isEndDateInvalid()"
                     class="is-full-width"
                     type="date"></admiralty-input>
  </div>

image

[BUG] Disabled labels fail WCAG 1.4.3 colour contrast

Labels for Disabled fields are not except from WCAG 1.4.3.

1.4.3 - Contrast - The visual presentation of text and images of text has a contrast ratio of at least 4.5:1, except for the following:
Large Text - Large-scale text and images of large-scale text have a contrast ratio of at least 3:1;
Incidental - Text or images of text that are part of an inactive user interface component, that are pure decoration, that are not visible to anyone, or that are part of a picture that contains significant other visual content, have no contrast requirement.
Logotypes - Text that is part of a logo or brand name has no contrast requirement.

Expected behavior
The label text should not be changed and add "(Disabled)" to the label.

image

[BUG] Web Components need to implement ControlValueAccessor in order to use angular formControl functions

Describe the bug
Cannot use formControl functions on the web components, in particular formControlName or formControlArray on most of the web components. Currently it displays the error attached.

image

<admiralty-select formControlName="purpose"
                            [hint]="'This helps us understand where to focus when processing your data'"
                            [label]="'Primary purpose of data collection *'">
    <option disabled></option>
    <ng-container *ngFor="let item of purposes">
      <option>{{item.purpose}}</option>
    </ng-container>
</admiralty-select>

[BUG] Progress bar colours are not correctly displayed when using the Firefox browser

Describe the bug
Progress bar colours are not correctly displayed when using the Firefox browser.

To Reproduce
Steps to reproduce the behaviour:

  1. Open Firefox
  2. View the Progress Bar stories

Expected behaviour
Colours of Progress Bar are displayed correctly across Chrome/Edge & Firefox.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Additional context
Screenshot shows Storybook 7 upgrade dev branch.

[BUG] Text Input Max Length Fails WCAG 3.3.3 Error Suggestion

Describe the bug
The max length text input is not accessible for non-sighted users as they are not notified when they type more than the max length and screen readers will continue to read out the characters they are typing without knowing that the field has stopped accepting characters.

This also effects users ability to copy or autofill text as they could paste text into the input and not realise not all the text copied over if the copied text is more than the max length limit.

Expected behaviour
My thoughts are text inputs should not stop users adding characters to the input but should error when a user enters more than the max length limit. Suggested error message '{Field name} must be {Max length} characters or less.'.

The error should appear once a user types over the max length limit or when they paste text more than the max limit rather than on change in focus.

Additional context
3.3.3: Error Suggestion - If an input error is automatically detected and suggestions for correction are known, then the suggestions are provided to the user, unless it would jeopardize the security or purpose of the content.

[BUG] Table missing certain ARIA roles that must contain particular children

Describe the bug
The admiralty-table-header has a role="rowgroup" with children with the role="columnheader" when it's expecting children with a role="row". Certain ARIA roles must contain particular children table > rowgroup > row > cell | coulmnheader | rowheader.

To Reproduce
Steps to reproduce the behavior:
Inspect the admiralty-table component and check the roles of each child.
Or run the Axe-core automated tests on a page containing the admiralty-table component

Expected behavior
There needs to be a admiralty-table-row inserted between admiralty-table-header and admiralty-table-header-cell.

Screenshots
image

Additional context
Using a native HTML table element whenever possible is strongly encouraged. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table

[BUG] Admiralty file input failing Axe-core accessibility tests

Describe the bug
When running Axe-core automated tests on a page with the file input component. The tests will fail due to the file input having an Aria-hidden="true" attribute while the input has focusable content.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to File input component page
  2. Inspect component
  3. The input has an Aria-hidden="true"

image

[BUG] Validation message space bouncing on web components

Describe the bug
When an invalid message is not displayed and then later is displayed, there is a bounce on the screen to compensate for the message

// With message:
<admiralty-input type="text"
                           label="Survey Title *"
                           name="Survey Title"
                           hint="We will use this to refer to the survey in communication with you"
                           [invalid]="true"
                           invalidMessage="Required"></admiralty-input>

// No message:
<admiralty-input type="text"
                           label="Survey Title 2*"
                           name="Survey Title 2"
                           hint="We will use this to refer to the survey in communication with you"
                           [invalid]="false"
                           invalidMessage="Required"></admiralty-input>

image

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.