The way you want to do it is wih the datalist HTML5 element - it does all the hard work for you.
I used it in one of my custom fields and it works great.
You need to create your own new field and use something like this code for it's showEditor function....Â
Blockly.FieldHtml.prototype.showEditor_ = function(opt_quietInput) {
 this.workspace_ = this.sourceBlock_.workspace;
 var quietInput = opt_quietInput || false;
           goog.userAgent.IPAD)) {
  // Mobile browsers have issues with in-line textareas (focus & keyboards).
  var newValue = window.prompt(Blockly.Msg.CHANGE_VALUE_TITLE, this.text_);
  if (this.sourceBlock_) {
   newValue = this.callValidator(newValue);
  }
  this.setValue(newValue);
  return;
 }Â
 Blockly.WidgetDiv.show(this, this.sourceBlock_.RTL, this.widgetDispose_());
 var div = Blockly.WidgetDiv.DIV;
 // Create the input.
 var htmlInput =Â
   goog.dom.createDom(goog.dom.TagName.INPUT, 'blocklyHtmlInput');
// Â htmlInput.setAttribute('spellcheck', this.spellcheck_);
 var fontSize =
   (Blockly.FieldHtml.FONTSIZE * this.workspace_.scale) + 'pt';
 div.style.fontSize = fontSize;
 htmlInput.style.fontSize = fontSize;
 var datalist = goog.dom.createDom(goog.dom.TagName.DATALIST);
 for (var i=0; i < this.autovalues_.length; i++) {
  var option = goog.dom.createDom(goog.dom.TagName.OPTION);
  option.setAttribute('value', this.autovalues_[i])
  datalist.appendChild(option);
 }
 datalist.setAttribute('id', 'datalist');
 htmlInput.setAttribute('list', 'datalist')
 /** @type {!HTMLInputElement} */
 Blockly.FieldHtml.htmlInput_ = htmlInput;
 div.appendChild(datalist);
 div.appendChild(htmlInput);
 htmlInput.value = htmlInput.defaultValue = this.text_;
 htmlInput.oldValue_ = null;
 this.validate_();
 this.resizeEditor_();
 if (!quietInput) {
  htmlInput.focus();
   htmlInput.select();
 }
 // Bind to keydown -- trap Enter without IME and Esc to hide.
 htmlInput.onKeyDownWrapper_ =
   Blockly.bindEventWithChecks_(htmlInput, 'keydown', this,
   this.onHtmlInputKeyDown_);
 // Bind to keyup -- trap Enter; resize after every keystroke.
 htmlInput.onKeyUpWrapper_ =
   Blockly.bindEventWithChecks_(htmlInput, 'keyup', this,
   this.onHtmlInputChange_);
 // Bind to keyPress -- repeatedly resize when holding down a key.
 htmlInput.onKeyPressWrapper_ =
   Blockly.bindEventWithChecks_(htmlInput, 'keypress', this,
   this.onHtmlInputChange_);
 htmlInput.onWorkspaceChangeWrapper_ = this.resizeEditor_.bind(this);
 this.workspace_.addChangeListener(htmlInput.onWorkspaceChangeWrapper_);
};