Stencil removes type attribute from button
@stencil/[email protected]
I'm submitting a: [ x] bug report
Current behavior: After updating stencil, The buttons in my component's JSX gets rendered without 'type' attribute, apparently stencil removes the type attribute from the buttons
Expected behavior: It should not remove type attribute
Steps to reproduce: Add a type attribute inside JSX with inline IF condition in a component
Related code:
TSX:
`return (
<div class="dialog-footer">
{this.okButtonText ?
<button class="ui button blue"
disabled={false} type={"submit"}>{this.okButtonText}</button> : ""}
{this.cancelButtonText ?
<button type={"button"} onClick={() => this.onHide.emit()}
class="ui button haze">{this.cancelButtonText}</button> : ""}
</div>
);`
AFTER BUILD:
`render() {
return (h("div", { class: "dialog-footer" }, this.okButtonText ?
h("button", { class: "ui button blue", disabled: false, type: "submit" }, this.okButtonText) : "", this.cancelButtonText ?
h("button", { type: "button", onClick: () => this.onHide.emit(), class: "ui button haze" }, this.cancelButtonText) : ""));
}`
FINAL HTML:
`<div class="dialog-footer"><button class="ui button blue">Save Settings</button></div>`
I verified further the attribute only gets removed if the value is "submit", remains intact if value is "button".
The default type of a <button> is submit anyways. So it shouldn't make any difference if it is removed...?
This should be fixed in the latest release of stencil, but indeed the default value is "submit"
@schadenn yes, but if I wanted to query that button with submit value in my code I cant do that if it is removed, I will have to work it around, assign an Id selector and use that to query.