diff --git a/src/components/inputnumber/InputNumber.vue b/src/components/inputnumber/InputNumber.vue index 8b5089c83..a3c4f8690 100755 --- a/src/components/inputnumber/InputNumber.vue +++ b/src/components/inputnumber/InputNumber.vue @@ -1,13 +1,13 @@ @@ -17,7 +17,6 @@ import Button from 'primevue/button'; export default { name: 'InputNumber', - inheritAttrs: false, emits: ['update:modelValue', 'input', 'focus', 'blur'], props: { modelValue: { @@ -112,10 +111,14 @@ export default { type: Boolean, default: false }, - style: null, - class: null, - inputStyle: null, - inputClass: null + disabled: { + type: Boolean, + default: false + }, + inputId: null, + inputProps: null, + incrementButtonProps: null, + decrementButtonProps: null }, numberFormat: null, _numeral: null, @@ -327,24 +330,24 @@ export default { } }, onUpButtonMouseDown(event) { - if (!this.$attrs.disabled) { + if (!this.disabled) { this.$refs.input.$el.focus(); this.repeat(event, null, 1); event.preventDefault(); } }, onUpButtonMouseUp() { - if (!this.$attrs.disabled) { + if (!this.disabled) { this.clearTimer(); } }, onUpButtonMouseLeave() { - if (!this.$attrs.disabled) { + if (!this.disabled) { this.clearTimer(); } }, onUpButtonKeyUp() { - if (!this.$attrs.disabled) { + if (!this.disabled) { this.clearTimer(); } }, @@ -354,24 +357,24 @@ export default { } }, onDownButtonMouseDown(event) { - if (!this.$attrs.disabled) { + if (!this.disabled) { this.$refs.input.$el.focus(); this.repeat(event, null, -1); event.preventDefault(); } }, onDownButtonMouseUp() { - if (!this.$attrs.disabled) { + if (!this.disabled) { this.clearTimer(); } }, onDownButtonMouseLeave() { - if (!this.$attrs.disabled) { + if (!this.disabled) { this.clearTimer(); } }, onDownButtonKeyUp() { - if (!this.$attrs.disabled) { + if (!this.disabled) { this.clearTimer(); } }, @@ -536,6 +539,22 @@ export default { } break; + //home + case 36: + if (this.min) { + this.updateModel(event, this.min); + event.preventDefault(); + } + break; + + //end + case 35: + if (this.max) { + this.updateModel(event, this.max); + event.preventDefault(); + } + break; + default: break; } @@ -947,7 +966,7 @@ export default { }, computed: { containerClass() { - return ['p-inputnumber p-component p-inputwrapper', this.class, { + return ['p-inputnumber p-component p-inputwrapper', { 'p-inputwrapper-filled': this.filled, 'p-inputwrapper-focus': this.focused, 'p-inputnumber-buttons-stacked': this.showButtons && this.buttonLayout === 'stacked', @@ -957,7 +976,7 @@ export default { }, upButtonClass() { - return ['p-inputnumber-button p-inputnumber-button-up', this.incrementButtonClass, { + return ['p-inputnumber-button p-inputnumber-button-up', { 'p-disabled': this.showButtons && this.max !== null && this.maxBoundry() }]; }, diff --git a/src/views/inputnumber/InputNumberDemo.vue b/src/views/inputnumber/InputNumberDemo.vue index 44466fe51..59e22c1a6 100755 --- a/src/views/inputnumber/InputNumberDemo.vue +++ b/src/views/inputnumber/InputNumberDemo.vue @@ -15,36 +15,36 @@
- +
- +
- +
- +
- +
- +
- +
- +
@@ -52,19 +52,19 @@
- +
- +
- +
- +
@@ -72,19 +72,19 @@
- +
- +
- +
- +
@@ -92,22 +92,22 @@
- +
-
- +
-
diff --git a/src/views/inputnumber/InputNumberDoc.vue b/src/views/inputnumber/InputNumberDoc.vue index 2c71eda05..0bfdee4cd 100755 --- a/src/views/inputnumber/InputNumberDoc.vue +++ b/src/views/inputnumber/InputNumberDoc.vue @@ -411,6 +411,58 @@ Vertical +
Accessibility
+ +
Screen Reader
+

Value to describe the component can either be provided via label tag combined with inputId prop or using aria-labelledby, aria-label props. + The input element uses spinbutton role in addition to the aria-valuemin, aria-valuemax and aria-valuenow attributes.

+ +

+<label for="price">Price</label>
+<InputNumber inputId="price" />
+
+<span id="label_number">Number</span>
+<InputNumber aria-labelledby="label_number" />
+
+<InputNumber aria-label="Number" />
+
+
+ +
Keyboard Support
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KeyFunction
tabMoves focus to the input.
up arrowIncrements the value.
down arrowDecrements the value.
homeSet the minimum value if provided.
endSet the maximum value if provided.
+
+
+
Dependencies

None.

@@ -430,36 +482,36 @@ export default {
- +
- +
- +
- +
- +
- +
- +
- +
@@ -467,19 +519,19 @@ export default {
- +
- +
- +
- +
@@ -487,19 +539,19 @@ export default {
- +
- +
- +
- +
@@ -507,22 +559,22 @@ export default {
- +
-
- +
-
@@ -567,36 +619,36 @@ export default {
- +
- +
- +
- +
- +
- +
- +
- +
@@ -604,19 +656,19 @@ export default {
- +
- +
- +
- +
@@ -624,19 +676,19 @@ export default {
- +
- +
- +
- +
@@ -644,22 +696,22 @@ export default {
- +
-
- +
-
@@ -705,36 +757,36 @@ export default {
- +
- +
- +
- +
- +
- +
- +
- +
@@ -742,19 +794,19 @@ export default {
- +
- +
- +
- +
@@ -762,19 +814,19 @@ export default {
- +
- +
- +
- +
@@ -782,22 +834,22 @@ export default {
- +
-
- +
-