diff --git a/core/field_image.js b/core/field_image.js
index f60c40a92..96a2d272a 100644
--- a/core/field_image.js
+++ b/core/field_image.js
@@ -191,6 +191,10 @@ Blockly.FieldImage.prototype.initView = function() {
this.fieldGroup_));
this.imageElement_.setAttributeNS(Blockly.utils.dom.XLINK_NS,
'xlink:href', /** @type {string} */ (this.value_));
+
+ if (this.clickHandler_) {
+ this.imageElement_.style.cursor = 'pointer';
+ }
};
/**
diff --git a/tests/blocks/test_blocks.js b/tests/blocks/test_blocks.js
index ff9b8a08b..bb1da03f9 100644
--- a/tests/blocks/test_blocks.js
+++ b/tests/blocks/test_blocks.js
@@ -1340,6 +1340,20 @@ Blockly.defineBlocksWithJsonArray([ // BEGIN JSON EXTRACT
}
]); // END JSON EXTRACT (Do not delete this comment.)
+Blockly.Blocks['test_images_clickhandler'] = {
+ init: function() {
+ this.appendDummyInput()
+ .appendField("Image click handler")
+ .appendField(new Blockly.FieldImage(
+ "https://blockly-demo.appspot.com/static/tests/media/a.png", 32, 32,
+ "image with click handlder", this.onClick_), "IMAGE");
+ this.setStyle('text_blocks');
+ },
+ onClick_: function() {
+ alert('Image clicked');
+ }
+};
+
Blockly.Blocks['test_validators_text_null'] = {
init: function() {
this.appendDummyInput()
diff --git a/tests/playground.html b/tests/playground.html
index 3523caa67..3f4362eba 100644
--- a/tests/playground.html
+++ b/tests/playground.html
@@ -1608,6 +1608,7 @@ var spaghettiXml = [
+