fix(core): update
This commit is contained in:
@ -54,7 +54,7 @@ export class DeesForm extends DeesElement {
|
||||
`;
|
||||
}
|
||||
|
||||
public firstUpdated() {
|
||||
public async firstUpdated() {
|
||||
const formChildren = this.getFormChildren();
|
||||
this.checkRequiredStatus();
|
||||
for (const child of formChildren) {
|
||||
@ -65,6 +65,7 @@ export class DeesForm extends DeesElement {
|
||||
this.checkRequiredStatus();
|
||||
});
|
||||
}
|
||||
await this.instrumentBehaviours();
|
||||
}
|
||||
|
||||
public getFormChildren() {
|
||||
@ -170,4 +171,21 @@ export class DeesForm extends DeesElement {
|
||||
|
||||
submitButton.text = textStateArg;
|
||||
}
|
||||
|
||||
public async instrumentBehaviours() {
|
||||
const children = this.getFormChildren();
|
||||
for (const child of children) {
|
||||
child.addEventListener('keydown', (eventArg) => {
|
||||
if (eventArg.key === 'Enter') {
|
||||
const currentIndex = children.indexOf(child);
|
||||
if (currentIndex < children.length - 1) {
|
||||
children[currentIndex + 1].focus();
|
||||
} else {
|
||||
children[currentIndex].blur();
|
||||
this.getSubmitButton().focus();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user