diff --git a/modules/ve/ce/ve.ce.BranchNode.js b/modules/ve/ce/ve.ce.BranchNode.js index db23213936..b0dd2627fd 100644 --- a/modules/ve/ce/ve.ce.BranchNode.js +++ b/modules/ve/ce/ve.ce.BranchNode.js @@ -227,7 +227,11 @@ ve.ce.BranchNode.prototype.setupSlugs = function () { slug = ve.ce.BranchNode.$inlineSlugTemplate[0]; } - if ( this.getLength() === 0 ) { + // If this content branch no longer has any rendered children, insert a slug to keep the node + // from becoming invisible/unfocusable. In Firefox, backspace after Ctrl-A leaves the document + // completely empty, so this ensures DocumentNode gets a slug. + // Can't use this.getLength() because the internal list adds to the length but doesn't render. + if ( this.$.children().length === 0 ) { this.slugs[0] = doc.importNode( slug, true ); this.$[0].appendChild( this.slugs[0] ); } else {