mirror of
https://github.com/scratchfoundation/scratch-blocks.git
synced 2025-08-20 09:59:28 -04:00
Drop-down and field bug fixes (#285)
* Only reset icon menu field colour if block still exists * Hide drop-downs and WidgetDiv on block creation
This commit is contained in:
parent
28a2b0479e
commit
0ca0b26037
2 changed files with 10 additions and 2 deletions
|
@ -276,8 +276,13 @@ Blockly.FieldIconMenu.prototype.buttonClick_ = function(e) {
|
|||
|
||||
Blockly.FieldIconMenu.prototype.onHide_ = function() {
|
||||
// Reset the button colour and clear accessibility properties
|
||||
this.sourceBlock_.setColour(this.savedPrimary_,
|
||||
this.sourceBlock_.getColourSecondary(), this.sourceBlock_.getColourTertiary());
|
||||
// Only attempt to do this reset if sourceBlock_ is not disposed.
|
||||
// It could become disposed before an onHide_, for example,
|
||||
// when a block is dragged from the flyout.
|
||||
if (this.sourceBlock_) {
|
||||
this.sourceBlock_.setColour(this.savedPrimary_,
|
||||
this.sourceBlock_.getColourSecondary(), this.sourceBlock_.getColourTertiary());
|
||||
}
|
||||
Blockly.DropDownDiv.content_.removeAttribute('role');
|
||||
Blockly.DropDownDiv.content_.removeAttribute('aria-haspopup');
|
||||
Blockly.DropDownDiv.content_.removeAttribute('aria-activedescendant');
|
||||
|
|
|
@ -910,6 +910,9 @@ Blockly.Flyout.prototype.createBlockFunc_ = function(originBlock) {
|
|||
var flyout = this;
|
||||
var workspace = this.targetWorkspace_;
|
||||
return function(e) {
|
||||
// Hide drop-downs and animating WidgetDiv immediately
|
||||
Blockly.WidgetDiv.hide(true);
|
||||
Blockly.DropDownDiv.hideWithoutAnimation();
|
||||
if (Blockly.isRightButton(e)) {
|
||||
// Right-click. Don't create a block, let the context menu show.
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue