diff --git a/packages/button/src/LionButton.js b/packages/button/src/LionButton.js index 726d2ff4f..353e793bc 100644 --- a/packages/button/src/LionButton.js +++ b/packages/button/src/LionButton.js @@ -176,12 +176,11 @@ export class LionButton extends DisabledWithTabIndexMixin(SlotMixin(LitElement)) } /** - * Prevent normal click and redispatch click on the native button unless already redispatched. + * Prevent normal click and redispatch submit on the native button unless already redispatched. */ - __clickDelegationHandler(e) { - if (!e.__isRedispatchedOnNativeButton) { - e.stopImmediatePropagation(); - this._redispatchClickEvent(e); + __clickDelegationHandler() { + if (this.type === 'submit' && this._nativeButtonNode.form) { + this._nativeButtonNode.form.submit(); } } diff --git a/packages/button/stories/index.stories.js b/packages/button/stories/index.stories.js index 0fa6c9d34..d12d7b515 100644 --- a/packages/button/stories/index.stories.js +++ b/packages/button/stories/index.stories.js @@ -35,9 +35,10 @@ storiesOf('Buttons|Button', module) .add( 'Within a form', () => html` - console.log('form submitted')} >
+ console.log(document.querySelector('#form').serializeGroup())} @@ -46,4 +47,16 @@ storiesOf('Buttons|Button', module)
`, - ); + ) + .add('Within another form', () => { + const submitForm = () => console.log('hey'); + return html` +
+

Details

+ + + + Submit +
+ `; + });