mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
dropdown and input fixes
This commit is contained in:
@@ -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) {
|
||||
if (target === undefined || target === null) {
|
||||
customElements.whenDefined(tagName).then(async () => {
|
||||
await (target as WaButton | WaIconButton).updateComplete;
|
||||
await (accessibleTrigger as WaButton | WaIconButton).updateComplete;
|
||||
this.updateAccessibleTrigger();
|
||||
});
|
||||
|
||||
|
||||
@@ -260,15 +260,21 @@ export default class WaInput extends WebAwesomeFormAssociatedElement {
|
||||
return;
|
||||
}
|
||||
|
||||
const button = [...form.elements].find((el: HTMLButtonElement) => el.type === 'submit' && !el.disabled) as
|
||||
const formElements = [...form.elements]
|
||||
|
||||
// If we're the only formElement, we submit like a native input.
|
||||
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 (!button) {
|
||||
form.requestSubmit(null);
|
||||
return;
|
||||
}
|
||||
// No button found, don't submit.
|
||||
if (!button) { return }
|
||||
|
||||
if (button.tagName.toLowerCase() === 'button') {
|
||||
form.requestSubmit(button);
|
||||
|
||||
Reference in New Issue
Block a user