From 7336d03538629d644e7b145d56bb36bf1091c159 Mon Sep 17 00:00:00 2001 From: CoryDCode Date: Thu, 1 Jun 2017 17:30:50 -0700 Subject: [PATCH] =?UTF-8?q?Fixing=20modals=20so=20they're=20announced=20on?= =?UTF-8?q?=20focus,=20and=20changing=20variables=20t=E2=80=A6=20(#1030)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fixing modals so they're announced on focus, and changing variables to only react to enter, not onChange. * Adding a temp index. * Whoops - added it in the wrong spot. --- accessible/field-segment.component.js | 10 +++++----- accessible/variable-add-modal.component.js | 4 +++- accessible/variable-modal.service.js | 5 ++++- accessible/variable-remove-modal.component.js | 13 +++++++++---- accessible/variable-rename-modal.component.js | 6 +++++- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/accessible/field-segment.component.js b/accessible/field-segment.component.js index 0f3ee6c58..4f2852a4e 100644 --- a/accessible/field-segment.component.js +++ b/accessible/field-segment.component.js @@ -156,6 +156,11 @@ blocklyApp.FieldSegmentComponent = ng.core.Component({ }, // Confirm a selection for dropdown fields. selectOption: function() { + if (this.optionValue != Blockly.Msg.RENAME_VARIABLE && this.optionValue != + Blockly.Msg.DELETE_VARIABLE.replace('%1', this.mainField.getValue())) { + this.mainField.setValue(this.optionValue); + } + if (this.optionValue == Blockly.Msg.RENAME_VARIABLE) { this.variableModalService.showRenameModal_(this.mainField.getValue()); } @@ -172,11 +177,6 @@ blocklyApp.FieldSegmentComponent = ng.core.Component({ return; } - if (this.optionValue != Blockly.Msg.RENAME_VARIABLE && this.optionValue != - Blockly.Msg.DELETE_VARIABLE.replace('%1', this.mainField.getValue())) { - this.mainField.setValue(this.optionValue); - } - var optionText = undefined; for (var i = 0; i < this.dropdownOptions.length; i++) { if (this.dropdownOptions[i].value == optionValue) { diff --git a/accessible/variable-add-modal.component.js b/accessible/variable-add-modal.component.js index 2220ce9ea..e113b49fb 100644 --- a/accessible/variable-add-modal.component.js +++ b/accessible/variable-add-modal.component.js @@ -43,6 +43,8 @@ blocklyApp.VariableAddModalComponent = ng.core.Component({
+

Add a variable...

+

New Variable Name: 1) { this.preRemoveShowHook(oldName, count); this.modalIsShown = true; @@ -74,6 +74,9 @@ blocklyApp.VariableModalService = ng.core.Class({ blocklyApp.workspace.deleteVariableInternal_(oldName); } }, + getNumVariables: function(oldName) { + return blocklyApp.workspace.getVariableUses(oldName).length; + }, // Hide the variable modal. hideModal: function() { this.modalIsShown = false; diff --git a/accessible/variable-remove-modal.component.js b/accessible/variable-remove-modal.component.js index 585f1cd61..480485342 100644 --- a/accessible/variable-remove-modal.component.js +++ b/accessible/variable-remove-modal.component.js @@ -43,10 +43,12 @@ blocklyApp.VariableRemoveModalComponent = ng.core.Component({

+

+ Delete {{getNumVariables()}} uses of the "{{currentVariableName}}" + variable? +

+ -

Remove {{count}} instances of - "{{currentVariableName}}" variable? -