Skip to content

Commit

Permalink
Merge branch 'main' into feature/inputter-validation-accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
MekalaNagarajan-Centrica authored Nov 6, 2024
2 parents af3868d + 6b99c15 commit bbf36a4
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 29 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 23 additions & 7 deletions packages/muon/components/inputter/src/inputter-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,24 @@ export class Inputter extends ScopedElementsMixin(ValidationMixin(MaskMixin(Muon
return false;
}

get _multiInputHeading() {
return html`
<legend>${this._addHeading}</legend>
`;
}

get __wrapperContent() {
return html`
${this._isMultiple ? this._multiInputHeading : this._addLabel}
${this._addHelper}
<div class="wrapper">
${super.standardTemplate}
${this._addMask}
${this._addInputTypeIcon}
</div>
`;
}

/**
* Getter method to construct template for type `standard`.
* @protected
Expand All @@ -243,13 +261,11 @@ export class Inputter extends ScopedElementsMixin(ValidationMixin(MaskMixin(Muon
return html`
<div class="${classMap(this.classes)}" style="${styleMap(this.inlineStyles)}" aria-describedby=${ifDefined(this.helper && !this.__isTipDetailAvailable ? this._helperId : undefined)}
aria-details=${ifDefined(this.helper && this.__isTipDetailAvailable ? this._helperId : undefined)}>
${this._isMultiple ? this._addHeading : this._addLabel}
${this._addHelper}
<div class="wrapper">
${super.standardTemplate}
${this._addMask}
${this._addInputTypeIcon}
</div>
${this._isMultiple ? html`
<fieldset>
${this.__wrapperContent}
</fieldset>
` : this.__wrapperContent}
</div>
${this._addValidationMessage}
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,39 +140,51 @@ snapshots["Inputter text mask & validation"] =

snapshots["Inputter radio standard radio"] =
`<div class="inputter radio">
<span class="input-heading">
What is your heating source?
</span>
<div class="wrapper">
<slot>
</slot>
</div>
<fieldset>
<legend>
<span class="input-heading">
What is your heating source?
</span>
</legend>
<div class="wrapper">
<slot>
</slot>
</div>
</fieldset>
</div>
`;
/* end snapshot Inputter radio standard radio */

snapshots["Inputter radio radio mask"] =
`<div class="has-mask inputter radio">
<span class="input-heading">
What is your heating source?
</span>
<div class="wrapper">
<slot>
</slot>
</div>
<fieldset>
<legend>
<span class="input-heading">
What is your heating source?
</span>
</legend>
<div class="wrapper">
<slot>
</slot>
</div>
</fieldset>
</div>
`;
/* end snapshot Inputter radio radio mask */

snapshots["Inputter radio radio mask validation"] =
`<div class="has-mask inputter radio">
<span class="input-heading">
What is your heating source?
</span>
<div class="wrapper">
<slot>
</slot>
</div>
<fieldset>
<legend>
<span class="input-heading">
What is your heating source?
</span>
</legend>
<div class="wrapper">
<slot>
</slot>
</div>
</fieldset>
</div>
`;
/* end snapshot Inputter radio radio mask validation */
Expand Down

0 comments on commit bbf36a4

Please sign in to comment.