Fixing Enter so it properly propogates to dropdown selection. (#934)

Fixing FieldSegment so it updates dropdowns when the underlying dropdown changes.
This commit is contained in:
CoryDCode
2017-02-15 11:13:32 -08:00
committed by GitHub
parent 0a73ae38f9
commit c3c1f83105
2 changed files with 4 additions and 3 deletions

View File

@@ -70,7 +70,7 @@ blocklyApp.FieldSegmentComponent = ng.core.Component({
this.notificationsService = notificationsService;
this.dropdownOptions = [];
}],
ngOnInit: function() {
ngDoCheck: function() {
if (this.isDropdown()) {
var rawOptions = this.mainField.getOptions_();
this.dropdownOptions = rawOptions.map(function(valueAndText) {

View File

@@ -484,8 +484,9 @@ blocklyApp.TreeService = ng.core.Class({
// Return the focus to the workspace tree containing the input field.
document.getElementById(treeId).focus();
// Note that Tab events are allowed to propagate through.
if (e.keyCode == 27) {
// Note that Tab and Enter events stop propagating, this behavior is
// handled on other listeners.
if (e.keyCode == 27 || e.keyCode == 13) {
e.preventDefault();
e.stopPropagation();
}