-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
component: commentshelp wantedExternal contributions actively solicitedExternal contributions actively solicitedissue: bugDescribes why the code or behaviour is wrongDescribes why the code or behaviour is wronglow priority
Description
Problem statement
Deleting a workspace comment by clicking on the "x" icon when it's selected deletes the comment, but throws warnings.
Expected Behavior
Comment is deleted and there are no warnings.
Steps to Reproduce
- Create a ws comment
- Select the comment for editing
- Click the comment's delete icon.
Stack Traces
Uncaught TypeError: Cannot read property 'blur' of null
at workspace_comment_render_svg.js:456
(anonymous) @ workspace_comment_render_svg.js:456
setTimeout (async)
Blockly.WorkspaceCommentSvg.blurFocus @ workspace_comment_render_svg.js:455
Blockly.WorkspaceCommentSvg.removeSelect @ workspace_comment_svg.js:242
Blockly.WorkspaceCommentSvg.unselect @ workspace_comment_svg.js:221
Blockly.WorkspaceCommentSvg.dispose @ workspace_comment_svg.js:109
Blockly.WorkspaceCommentSvg.deleteMouseUp_ @ workspace_comment_render_svg.js:308
wrapFunc @ blockly.js:458
workspace_comment_render_svg.js:456 Uncaught TypeError: Cannot read property 'blur' of null
at workspace_comment_render_svg.js:456
(anonymous) @ workspace_comment_render_svg.js:456
setTimeout (async)
Blockly.WorkspaceCommentSvg.blurFocus @ workspace_comment_render_svg.js:455
Blockly.WorkspaceCommentSvg.unselect @ workspace_comment_svg.js:222
Blockly.WorkspaceCommentSvg.dispose @ workspace_comment_svg.js:109
Blockly.WorkspaceCommentSvg.deleteMouseUp_ @ workspace_comment_render_svg.js:308
wrapFunc @ blockly.js:458
Additional Information
This is because we're deferring some style changes to the end of the frame, and the relevant svg elements have already been deleted by then. The solution is probably to explicitly track whether the comment has already been deleted.
Relevant code in workspace_comment_render_svg:
/**
* Remove focus from the text area.
* @package
*/
Blockly.WorkspaceCommentSvg.prototype.blurFocus = function() {
var comment = this;
this.focused_ = false;
// Defer CSS changes.
setTimeout(function() {
comment.textarea_.blur();
comment.removeFocus();
Blockly.utils.removeClass(
comment.svgRectTarget_, 'blocklyCommentTargetFocused');
Blockly.utils.removeClass(
comment.svgHandleTarget_, 'blocklyCommentHandleTargetFocused');
}, 0);
};
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
component: commentshelp wantedExternal contributions actively solicitedExternal contributions actively solicitedissue: bugDescribes why the code or behaviour is wrongDescribes why the code or behaviour is wronglow priority