revert dropdown / input

This commit is contained in:
konnorrogers
2024-06-18 16:13:38 -04:00
parent 0b1b976ff5
commit 50dda5d487
2 changed files with 7 additions and 14 deletions

View File

@@ -295,9 +295,9 @@ export default class WaDropdown extends WebAwesomeElement {
// Either the tag hasn't registered, or it hasn't rendered.
// So, wait for the tag to register, and then try again.
if (target === undefined || target === null) {
if (target === undefined) {
customElements.whenDefined(tagName).then(async () => {
await (accessibleTrigger as WaButton | WaIconButton).updateComplete;
await (target as WaButton | WaIconButton).updateComplete;
this.updateAccessibleTrigger();
});

View File

@@ -260,20 +260,13 @@ export default class WaInput extends WebAwesomeFormAssociatedElement {
return;
}
const formElements = [...form.elements];
const button = [...form.elements].find((el: HTMLButtonElement) => el.type === 'submit' && !el.disabled) as
| undefined
| HTMLButtonElement
| WaButton;
// If this is the only element in the form, submit the form.
if (formElements.length === 1) {
form.requestSubmit(null);
return;
}
const button = formElements.find(
(el: HTMLButtonElement) => el.type === 'submit' && !el.matches(':disabled')
) as undefined | HTMLButtonElement | WaButton;
// If there's no submit buttons, don't submit the form.
if (!button) {
form.requestSubmit(null);
return;
}