Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit da6ae8b

Browse files
committed
docs(*): don't hide results for middle-clicks
Middle-clicking opens a link in a new tab; it shouldn't close the results list as the user may want to open more of those links. Closes #16233
1 parent efaf59f commit da6ae8b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

docs/app/src/search.js

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ angular.module('search', [])
6767
clearResults();
6868
$scope.q = '';
6969
};
70+
71+
$scope.handleResultClicked = function($event) {
72+
if ($event.which === 1 && !$event.ctrlKey && !$event.metaKey) {
73+
$scope.hideResults();
74+
}
75+
};
7076
}])
7177

7278

docs/config/templates/app/indexPage.template.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ <h1 class="brand"><a href="http://angularjs.org"><img width="117" height="30" sr
132132
<div ng-repeat="(key, value) in results track by key" class="search-results-group" ng-class="colClassName + ' col-group-' + key" ng-show="value.length > 0">
133133
<h4 class="search-results-group-heading">{{ key }}</h4>
134134
<ul class="search-results">
135-
<li ng-repeat="item in value" class="search-result"><a ng-click="hideResults()" ng-href="{{ item.path }}">{{ item.name }}</a></li>
135+
<li ng-repeat="item in value" class="search-result"><a ng-click="handleResultClicked($event)" ng-href="{{ item.path }}">{{ item.name }}</a></li>
136136
</ul>
137137
</div>
138138
</div>

0 commit comments

Comments
 (0)