Skip to content

Commit

Permalink
Fix: Hide mobile dialog on first outside click (#26)
Browse files Browse the repository at this point in the history
* Fix: Hide mobile dialog on first outside click
* Fix: Fit create textarea inside tablet dialog
  • Loading branch information
pramodsum authored Nov 11, 2017
1 parent 0ba1965 commit 01ec48b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/MobileAnnotator.scss
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ $tablet: "(min-width: 768px)";
@include border-top-bottom;
}

.bp-mobile-annotation-dialog .annotation-container section[data-section="create"],
.bp-mobile-annotation-dialog .annotation-container {
@media #{$tablet} {
left: auto;
Expand Down
2 changes: 2 additions & 0 deletions src/doc/DocAnnotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,8 @@ class DocAnnotator extends Annotator {
}

consumed = consumed || threadActive;
} else if (this.isMobile) {
thread.hideDialog();
}
});

Expand Down
11 changes: 10 additions & 1 deletion src/doc/__tests__/DocAnnotator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ describe('doc/DocAnnotator', () => {
show: () => {},
reset: () => {},
destroy: () => {},
onMousemove: () => {}
onMousemove: () => {},
hideDialog: () => {}
};
stubs.threadMock = sandbox.mock(stubs.thread);

Expand Down Expand Up @@ -1278,6 +1279,14 @@ describe('doc/DocAnnotator', () => {
annotator.threads = {};
});

it('should hide threads that are not pending nor highlights', () => {
stubs.thread.type = TYPES.point;
stubs.thread.state = STATES.hover;
annotator.isMobile = true;
stubs.threadMock.expects('hideDialog');
annotator.highlightClickHandler(stubs.event);
});

it('should cancel the first comment of pending point thread', () => {
stubs.thread.type = TYPES.point;
stubs.threadMock.expects('destroy');
Expand Down

0 comments on commit 01ec48b

Please sign in to comment.