Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
de492c2
Initial plan
Copilot Aug 19, 2025
6d1fd3a
Initial exploration and understanding of the DB Switch double event i…
Copilot Aug 19, 2025
021d58e
Fix double event firing in DB Switch with Angular signals
Copilot Aug 19, 2025
439d623
Remove unrelated files from PR - keep only the actual DB Switch fix
Copilot Aug 20, 2025
60a48b4
docs: provide an example for a signal based switch
mfranzke Aug 20, 2025
85049c0
refactor: regenerated package lock file
mfranzke Aug 20, 2025
12e61ea
refactor: regenerated package lock file
mfranzke Aug 20, 2025
10eb8fd
Changes before error encountered
Copilot Sep 8, 2025
1755bcf
Update .gitignore
mfranzke Sep 8, 2025
90d15d5
refactor: updated package-lock.json file from main
mfranzke Sep 8, 2025
0b4163d
merge
mfranzke Sep 8, 2025
b069487
Merge branch 'main' into copilot/fix-4599
mfranzke Sep 12, 2025
f6cbf0d
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 19, 2025
6363166
fix(switch): prevent double change events by skipping props.onChange …
michaelmkraus Sep 25, 2025
5ed4406
chore(switch): remove console.log
michaelmkraus Sep 25, 2025
4138fb9
fix(switch): call onchange only if set
michaelmkraus Sep 25, 2025
26e222e
fix(switch): use old path to components
michaelmkraus Sep 25, 2025
75ff0ea
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 25, 2025
1a1429b
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 25, 2025
e1dc042
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 25, 2025
468b37d
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 26, 2025
a99d4a5
Merge branch 'main' into copilot/fix-4599
michaelmkraus Sep 26, 2025
c3674be
Merge branch 'main' into copilot/fix-4599
nmerget Sep 29, 2025
babda15
chore: add changeset
nmerget Sep 29, 2025
b238811
Merge branch 'main' into copilot/fix-4599
mfranzke Sep 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/4779-accessibility-improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@db-ux/core-components": patch
"@db-ux/ngx-core-components": patch
"@db-ux/react-core-components": patch
"@db-ux/v-core-components": patch
"@db-ux/wc-core-components": patch
---

- fix(DB Switch): double event firing with Angular signals
11 changes: 6 additions & 5 deletions packages/components/src/components/switch/switch.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ export default function DBSwitch(props: DBSwitchProps) {
const state = useStore<DBSwitchState>({
_id: undefined,
handleChange: (event: ChangeEvent<HTMLInputElement>) => {
if (props.onChange) {
props.onChange(event);
}

useTarget({
angular: () =>
handleFrameworkEventAngular(state, event, 'checked'),
vue: () => handleFrameworkEventVue(() => {}, event, 'checked')
vue: () => handleFrameworkEventVue(() => {}, event, 'checked'),
default: () => {
if (props.onChange) {
props.onChange(event);
}
}
});
},
handleBlur: (event: InteractionEvent<HTMLInputElement>) => {
Expand Down
2 changes: 0 additions & 2 deletions packages/components/src/utils/form-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ export const handleFrameworkEventAngular = (
event: any,
modelValue: string = 'value'
): void => {
// Change event to work with reactive and template driven forms
component.propagateChange(event.target[modelValue]);
component.writeValue(event.target[modelValue]);
};

export const handleFrameworkEventVue = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@
</db-button>
</fieldset>
</form>

<p>Switch with Angular signals</p>
<db-switch
[checked]="checkedSignal()"
(change)="handleChange($event)"
label="My Switch"
>
</db-switch>
</div>
<div>
<h1>Output</h1>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {
Component,
CUSTOM_ELEMENTS_SCHEMA,
NO_ERRORS_SCHEMA
NO_ERRORS_SCHEMA,
signal
} from '@angular/core';
import {
FormControl,
Expand All @@ -16,6 +17,7 @@ import {
DBInput,
DBRadio,
DBSelect,
DBSwitch,
DBTabItem,
DBTabList,
DBTabPanel,
Expand Down Expand Up @@ -44,12 +46,16 @@ import { environment } from '../../../environments/environment';
DBTabs,
DBTabList,
DBTabItem,
DBTabPanel
DBTabPanel,
DBSwitch
],
standalone: true,
schemas: [NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA]
})
export class FormComponent {
// DB Switch with Angular signals
checkedSignal = signal(false);

array = ['X', 'Y', 'Z'];
radio = '';
input = '';
Expand Down Expand Up @@ -150,4 +156,8 @@ export class FormComponent {
})
);
}

handleChange(event: any) {
this.checkedSignal.set(event.target.checked);
}
}
Loading