-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Rating : the null value is accessible by key but not by click #3246
Comments
Hello karianna, |
Hi @jegeay You can test fixed version over here https://jsfiddle.net/RopoMen/bsbmcvza/embedded/result/ |
Hi @RopoMen That works fine ! Thanks a lot for this great improvement 👍 The only annoying thing : it is not very intuitive to click twice to get 0. |
But hover is not working with mobile devices. |
You're right... But at least, it would be better for your computers users. it become an intuitive standard on computer, then it will be a standard also on mobile devices. |
The zero value can be reached with the keyboard (left key) but with the mouse the minimum rate is 1.
This can lead to unexpected results in the treatment of the rates.
A solution to make this consistent can be to limit minimum rate to 1 even with the keyboard :
$scope.rate = function(value) {
if ( !$scope.readonly && value >= 1 && value <= $scope.range.length ) {
ngModelCtrl.$setViewValue(value);
ngModelCtrl.$render();
}
};
[...]
angular.module("template/rating/rating.html", []).run(["$templateCache", function($templateCache) {
$templateCache.put("template/rating/rating.html",
"<span ng-mouseleave="reset()" ng-keydown="onKeydown($event)" tabindex="0" role="slider" aria-valuemin="1" aria-valuemax="{{range.length}}" aria-valuenow="{{value}}">\n" +
" <i ng-repeat="r in range track by $index" ng-mouseenter="enter($index + 1)" ng-click="rate($index + 1)" class="glyphicon" ng-class="$index < value && (r.stateOn || 'glyphicon-star') || (r.stateOff || 'glyphicon-star-empty')">\n" +
" <span class="sr-only">({{ $index < value ? '*' : ' ' }})\n" +
" \n" +
"");
}]);
Another solution could be to be able to set rate=0 with the mouse. But I don't know how to do this....
The text was updated successfully, but these errors were encountered: