fix(InputNumber): add button type attribute, fixes #5700

Adds a button type to html button element to prevent form submits when placed within a form.
pull/5701/head
Michael Meier 2024-05-08 14:45:15 +02:00 committed by GitHub
parent 1305a23abf
commit 5173d5333e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -30,14 +30,14 @@
/> />
<span v-if="showButtons && buttonLayout === 'stacked'" :class="cx('buttonGroup')" v-bind="ptm('buttonGroup')"> <span v-if="showButtons && buttonLayout === 'stacked'" :class="cx('buttonGroup')" v-bind="ptm('buttonGroup')">
<slot name="incrementbutton" :listeners="upButtonListeners"> <slot name="incrementbutton" :listeners="upButtonListeners">
<button :class="[cx('incrementButton'), incrementButtonClass]" v-on="upButtonListeners" :disabled="disabled" :tabindex="-1" aria-hidden="true" v-bind="ptm('incrementButton')"> <button :class="[cx('incrementButton'), incrementButtonClass]" v-on="upButtonListeners" :disabled="disabled" :tabindex="-1" aria-hidden="true" v-bind="ptm('incrementButton')" type="button">
<slot :name="$slots.incrementicon ? 'incrementicon' : 'incrementbuttonicon'"> <slot :name="$slots.incrementicon ? 'incrementicon' : 'incrementbuttonicon'">
<component :is="incrementIcon || incrementButtonIcon ? 'span' : 'AngleUpIcon'" :class="[incrementIcon, incrementButtonIcon]" v-bind="ptm('incrementIcon')" data-pc-section="incrementicon" /> <component :is="incrementIcon || incrementButtonIcon ? 'span' : 'AngleUpIcon'" :class="[incrementIcon, incrementButtonIcon]" v-bind="ptm('incrementIcon')" data-pc-section="incrementicon" />
</slot> </slot>
</button> </button>
</slot> </slot>
<slot name="decrementbutton" :listeners="downButtonListeners"> <slot name="decrementbutton" :listeners="downButtonListeners">
<button :class="[cx('decrementButton'), decrementButtonClass]" v-on="downButtonListeners" :disabled="disabled" :tabindex="-1" aria-hidden="true" v-bind="ptm('decrementButton')"> <button :class="[cx('decrementButton'), decrementButtonClass]" v-on="downButtonListeners" :disabled="disabled" :tabindex="-1" aria-hidden="true" v-bind="ptm('decrementButton')" type="button">
<slot :name="$slots.decrementicon ? 'decrementicon' : 'decrementbuttonicon'"> <slot :name="$slots.decrementicon ? 'decrementicon' : 'decrementbuttonicon'">
<component :is="decrementIcon || decrementButtonIcon ? 'span' : 'AngleDownIcon'" :class="[decrementIcon, decrementButtonIcon]" v-bind="ptm('decrementIcon')" data-pc-section="decrementicon" /> <component :is="decrementIcon || decrementButtonIcon ? 'span' : 'AngleDownIcon'" :class="[decrementIcon, decrementButtonIcon]" v-bind="ptm('decrementIcon')" data-pc-section="decrementicon" />
</slot> </slot>
@ -45,14 +45,14 @@
</slot> </slot>
</span> </span>
<slot name="incrementbutton" :listeners="upButtonListeners"> <slot name="incrementbutton" :listeners="upButtonListeners">
<button v-if="showButtons && buttonLayout !== 'stacked'" :class="[cx('incrementButton'), incrementButtonClass]" v-on="upButtonListeners" :disabled="disabled" :tabindex="-1" aria-hidden="true" v-bind="ptm('incrementButton')"> <button v-if="showButtons && buttonLayout !== 'stacked'" :class="[cx('incrementButton'), incrementButtonClass]" v-on="upButtonListeners" :disabled="disabled" :tabindex="-1" aria-hidden="true" v-bind="ptm('incrementButton')" type="button">
<slot :name="$slots.incrementicon ? 'incrementicon' : 'incrementbuttonicon'"> <slot :name="$slots.incrementicon ? 'incrementicon' : 'incrementbuttonicon'">
<component :is="incrementIcon || incrementButtonIcon ? 'span' : 'AngleUpIcon'" :class="[incrementIcon, incrementButtonIcon]" v-bind="ptm('incrementIcon')" data-pc-section="incrementicon" /> <component :is="incrementIcon || incrementButtonIcon ? 'span' : 'AngleUpIcon'" :class="[incrementIcon, incrementButtonIcon]" v-bind="ptm('incrementIcon')" data-pc-section="incrementicon" />
</slot> </slot>
</button> </button>
</slot> </slot>
<slot name="decrementbutton" :listeners="downButtonListeners"> <slot name="decrementbutton" :listeners="downButtonListeners">
<button v-if="showButtons && buttonLayout !== 'stacked'" :class="[cx('decrementButton'), decrementButtonClass]" v-on="downButtonListeners" :disabled="disabled" :tabindex="-1" aria-hidden="true" v-bind="ptm('decrementButton')"> <button v-if="showButtons && buttonLayout !== 'stacked'" :class="[cx('decrementButton'), decrementButtonClass]" v-on="downButtonListeners" :disabled="disabled" :tabindex="-1" aria-hidden="true" v-bind="ptm('decrementButton')" type="button">
<slot :name="$slots.decrementicon ? 'decrementicon' : 'decrementbuttonicon'"> <slot :name="$slots.decrementicon ? 'decrementicon' : 'decrementbuttonicon'">
<component :is="decrementIcon || decrementButtonIcon ? 'span' : 'AngleDownIcon'" :class="[decrementIcon, decrementButtonIcon]" v-bind="ptm('decrementIcon')" data-pc-section="decrementicon" /> <component :is="decrementIcon || decrementButtonIcon ? 'span' : 'AngleDownIcon'" :class="[decrementIcon, decrementButtonIcon]" v-bind="ptm('decrementIcon')" data-pc-section="decrementicon" />
</slot> </slot>