mirror of
https://github.com/google/blockly.git
synced 2026-01-10 02:17:09 +01:00
Add valuemin and valuemax aria properties for number fields (#2850)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user