diff --git a/core/field_number.js b/core/field_number.js index 496ee66f6..4c1c20a3e 100644 --- a/core/field_number.js +++ b/core/field_number.js @@ -139,4 +139,25 @@ Blockly.FieldNumber.prototype.doClassValidation_ = function(opt_newValue) { return n; }; +/** + * Create the number input editor widget. + * @return {!HTMLInputElement} The newly created number input editor. + * @protected + * @override + */ +Blockly.FieldNumber.prototype.widgetCreate_ = function() { + var htmlInput = Blockly.FieldNumber.superClass_.widgetCreate_.call(this); + + // Set the accessibility state + if (this.min_ > -Infinity) { + Blockly.utils.aria.setState(htmlInput, + Blockly.utils.aria.State.VALUEMIN, this.min_); + } + if (this.max_ < Infinity) { + Blockly.utils.aria.setState(htmlInput, + Blockly.utils.aria.State.VALUEMAX, this.max_); + } + return htmlInput; +}; + Blockly.fieldRegistry.register('field_number', Blockly.FieldNumber); diff --git a/core/field_textinput.js b/core/field_textinput.js index a8f9b6f3b..a08df12ca 100644 --- a/core/field_textinput.js +++ b/core/field_textinput.js @@ -249,7 +249,7 @@ Blockly.FieldTextInput.prototype.showInlineEditor_ = function(quietInput) { /** * Create the text input editor widget. * @return {!HTMLInputElement} The newly created text input editor. - * @private + * @protected */ Blockly.FieldTextInput.prototype.widgetCreate_ = function() { var div = Blockly.WidgetDiv.DIV;