Skip to content

Commit

Permalink
fix(search-pad): clear selection when search opens
Browse files Browse the repository at this point in the history
This ensures that all visual clutter is gone once the search pad
is opened. Of course, on <Escape> the search restores.
  • Loading branch information
nikku committed Nov 5, 2024
1 parent 010d127 commit 5d8eb9a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/features/search-pad/SearchPad.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ SearchPad.prototype.open = function() {
this._cachedSelection = this._selection.get();
this._cachedViewbox = this._canvas.viewbox();

this._selection.select(null);

this._bindEvents();

this._open = true;
Expand Down
13 changes: 13 additions & 0 deletions test/spec/features/search-pad/SearchPadSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,19 @@ describe('features/search-pad', function() {
}));


it('should clear selection', inject(function(searchPad, selection) {

// given
selection.select(elements.one.a);

// when
searchPad.open();

// then
expect(selection.get()).to.be.empty;
}));


it('should error when provider not registered', inject(function(searchPad) {

// given
Expand Down

0 comments on commit 5d8eb9a

Please sign in to comment.