Selaa lähdekoodia

Merge pull request #1387 from blink1073/fix-cell-keyboard-movement

Clean up edge request behavior
Afshin Darian 8 vuotta sitten
vanhempi
commit
1758570435
1 muutettua tiedostoa jossa 8 lisäystä ja 0 poistoa
  1. 8 0
      src/notebook/notebook/widget.ts

+ 8 - 0
src/notebook/notebook/widget.ts

@@ -1032,6 +1032,9 @@ class Notebook extends StaticNotebook {
    */
   private _onEdgeRequest(widget: Widget, location: EdgeLocation): void {
     let prev = this.activeCellIndex;
+    // Clear the previous cell focus.
+    this.node.focus();
+
     if (location === 'top') {
       this.activeCellIndex--;
       // Move the cursor to the first position on the last line.
@@ -1046,8 +1049,13 @@ class Notebook extends StaticNotebook {
         this.activeCell.editor.setCursorPosition(0);
       }
     }
+    // Attempt to focus the new cell.
+    this.activeCell.activate();
   }
 
+  /**
+   * Ensure that the notebook has proper focus.
+   */
   private _ensureFocus(): void {
     let activeCell = this.activeCell;
     if (this.mode === 'edit' && activeCell) {