diff --git a/packages/webawesome/docs/docs/resources/changelog.md b/packages/webawesome/docs/docs/resources/changelog.md index 93140c072..bbe8c61a6 100644 --- a/packages/webawesome/docs/docs/resources/changelog.md +++ b/packages/webawesome/docs/docs/resources/changelog.md @@ -22,6 +22,7 @@ Components with the Experimental badge sh - Fixed a bug in `` that caused the browser to hang when cancelling the `wa-hide` event [issue:1483] - Improved performance of `` so initial rendering occurs faster, especially with multiple icons on the page [issue:1729] - Fixed a bug in Web Awesome form controls that caused `` to set the form property to equal `"foo"` instead of returning an `HTMLFormElement` breaking platform expectations. [pr:1815] +- Fixed a bug in `` causing it to not copy over attributes for form submissions. [pr:1815] - Modified the default `transition` styles of `` to use design tokens [pr:1693] ## 3.0.0 diff --git a/packages/webawesome/src/components/button/button.ts b/packages/webawesome/src/components/button/button.ts index 56fae72aa..0b1b7256f 100644 --- a/packages/webawesome/src/components/button/button.ts +++ b/packages/webawesome/src/components/button/button.ts @@ -134,24 +134,23 @@ export default class WaButton extends WebAwesomeFormAssociatedElement { private constructLightDOMButton() { const button = document.createElement('button'); + + for (const attribute of this.attributes) { + button.setAttribute(attribute.name, attribute.value) + } + button.type = this.type; - button.style.position = 'absolute'; - button.style.width = '0'; - button.style.height = '0'; - button.style.clipPath = 'inset(50%)'; - button.style.overflow = 'hidden'; - button.style.whiteSpace = 'nowrap'; + button.style.position = 'absolute !important'; + button.style.width = '0 !important'; + button.style.height = '0 !important'; + button.style.clipPath = 'inset(50%) !important'; + button.style.overflow = 'hidden !important'; + button.style.whiteSpace = 'nowrap !important'; if (this.name) { button.name = this.name; } button.value = this.value || ''; - ['form', 'formaction', 'formenctype', 'formmethod', 'formnovalidate', 'formtarget'].forEach(attr => { - if (this.hasAttribute(attr)) { - button.setAttribute(attr, this.getAttribute(attr)!); - } - }); - return button; }