Skip to content

Commit

Permalink
🐛 fix(bal-input): Duplicate id's and unable to set own id's (#1569)
Browse files Browse the repository at this point in the history
* Create PR for #1506

* fix(bal-field): id assignment of children

* chore: fix format

* fix(bal-field): id assignment of children

* fix(a11y): current state

* fix(a11y): prevent object manipulation of ariaForm to not introduce issues with id generations of components

* fix(a11y): reformat

* fix(a11y): add changeset

* update base images

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Yannick Holzenkamp <yannick@holzenkamp.me>
Co-authored-by: Marco Zirkenbach <marco.zirkenbach@baloise.ch>
Co-authored-by: hirsch88 <hirsch88@users.noreply.github.com>
  • Loading branch information
4 people authored Jan 31, 2025
1 parent 911b75f commit dcd9784
Show file tree
Hide file tree
Showing 35 changed files with 48 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .changeset/short-seals-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@baloise/ds-core': patch
---

**field**: fix id generation to prevent duplicate ids in a form
5 changes: 5 additions & 0 deletions .changeset/thick-lies-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@baloise/ds-core': patch
---

**core**: Fix id assignment of bal-field children
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/core/src/components/bal-field/bal-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export class Field implements ComponentInterface, BalMutationObserver {
'bal-field-control bal-file-upload',
])

const ariaForm = defaultBalAriaForm
const ariaForm = { ...defaultBalAriaForm }

if (label) {
ariaForm.labelId = `${this.fieldId}-lbl`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,45 @@
<bal-doc-app>
<main class="container py-medium">
<section data-testid="basic">
<bal-select multiple data-testid="basic-input" placeholder="Placeholder">
<bal-select-option label="Option 1" value="opt-1">Option 1</bal-select-option>
<bal-select-option label="Option 2" value="opt-2">Option 2</bal-select-option>
<bal-select-option label="Option 3" value="opt-3">Option 3</bal-select-option>
<bal-select-option label="Option 4" value="opt-4">Option 4</bal-select-option>
<bal-select-option label="Option 5" value="opt-5">Option 5</bal-select-option>
<bal-select-option label="Option 6" value="opt-6">Option 6</bal-select-option>
<bal-select-option label="Option 7" value="opt-7">Option 7</bal-select-option>
</bal-select>
<bal-field>
<bal-field-label>Label</bal-field-label>
<bal-field-control>
<bal-select multiple data-testid="basic-input" placeholder="Placeholder">
<bal-select-option label="Option 1" value="opt-1">Option 1</bal-select-option>
<bal-select-option label="Option 2" value="opt-2">Option 2</bal-select-option>
<bal-select-option label="Option 3" value="opt-3">Option 3</bal-select-option>
<bal-select-option label="Option 4" value="opt-4">Option 4</bal-select-option>
<bal-select-option label="Option 5" value="opt-5">Option 5</bal-select-option>
<bal-select-option label="Option 6" value="opt-6">Option 6</bal-select-option>
<bal-select-option label="Option 7" value="opt-7">Option 7</bal-select-option>
</bal-select>
</bal-field-control>
<bal-field-message>Message</bal-field-message>
</bal-field>
</section>
<section data-testid="disabled">
<bal-select multiple disabled value="opt-1,opt-2">
<bal-select-option label="Option 1" value="opt-1">Option 1</bal-select-option>
<bal-select-option label="Option 2" value="opt-2">Option 2</bal-select-option>
</bal-select>
<bal-field>
<bal-field-label>Label</bal-field-label>
<bal-field-control>
<bal-select multiple disabled value="opt-1,opt-2">
<bal-select-option label="Option 1" value="opt-1">Option 1</bal-select-option>
<bal-select-option label="Option 2" value="opt-2">Option 2</bal-select-option>
</bal-select>
</bal-field-control>
<bal-field-message>Message</bal-field-message>
</bal-field>
</section>
<section data-testid="invalid">
<bal-select multiple invalid value="opt-1,opt-2">
<bal-select-option label="Option 1" value="opt-1">Option 1</bal-select-option>
<bal-select-option label="Option 2" value="opt-2">Option 2</bal-select-option>
</bal-select>
<bal-field>
<bal-field-label>Label</bal-field-label>
<bal-field-control>
<bal-select multiple invalid value="opt-1,opt-2">
<bal-select-option label="Option 1" value="opt-1">Option 1</bal-select-option>
<bal-select-option label="Option 2" value="opt-2">Option 2</bal-select-option>
</bal-select>
</bal-field-control>
<bal-field-message>Message</bal-field-message>
</bal-field>
</section>
<section data-testid="field">
<bal-field>
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/utils/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export interface BalAriaFormLinking {
setAriaForm(ariaForm: BalAriaForm): Promise<void>
}

export const defaultBalAriaForm: BalAriaForm = {
export const defaultBalAriaForm: BalAriaForm = Object.freeze({
controlId: undefined,
labelId: undefined,
messageId: undefined,
}
})

0 comments on commit dcd9784

Please sign in to comment.