Skip to content

Commit

Permalink
[ZEPPELIN-2448] Fix paragraph navigation issue
Browse files Browse the repository at this point in the history
### What is this PR for?
* Keyboard events are broadcasted to components in lower tree
* Focus was getting transferred to the lower paragraphs, causing a chaining effect
* Making emit synchronous fixes the problem

### What type of PR is it?
[Bug Fix]

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-2448

### How should this be tested?
* Open a notebook with three or more paragraphs (A, B, C, D) one below the other
* Hide editor in B and C
* Try to navigate A to D
* The focus is passed through all four paragraphs

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No

Author: sravan <sravans2011@gmail.com>

Closes #2290 from sravan-s/ZEPPELIN-2448 and squashes the following commits:

a01ba7c [sravan] Fix paragraph navigation issue
  • Loading branch information
sravan-s authored and Leemoonsoo committed Apr 28, 2017
1 parent a593a8b commit d82f42d
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,8 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
$scope.$emit('moveFocusToPreviousParagraph', paragraphId)
} else if (editorHide && (keyCode === 40 || (keyCode === 78 && keyEvent.ctrlKey && !keyEvent.altKey))) { // down
// move focus to next paragraph
$scope.$emit('moveFocusToNextParagraph', paragraphId)
// $timeout stops chaining effect of focus propogation
$timeout(() => $scope.$emit('moveFocusToNextParagraph', paragraphId))
} else if (keyEvent.shiftKey && keyCode === 13) { // Shift + Enter
$scope.runParagraphFromShortcut($scope.getEditorValue())
} else if (keyEvent.ctrlKey && keyEvent.altKey && keyCode === 67) { // Ctrl + Alt + c
Expand Down

0 comments on commit d82f42d

Please sign in to comment.