I've encountered a strange issue with my directive in Firefox. The directive is designed to limit user input, and it functions correctly in Chrome. However, in Firefox, once the user reaches the input limit, they are unable to delete any characters - the backspace key seems to be locked and no keys work at all. For instance, if a user tries to input more than 999, the keyboard locks in Chrome but allows for deletion. In contrast, Firefox does not allow for deletion or input of any number. Any suggestions?
.directive("limitTo", [function() {
return {
restrict: "A",
link: function(scope, elem, attrs) {
var limit = parseInt(attrs.limitTo);
angular.element(elem).on("keypress", function() {
if (this.value.length == limit){
return false;
}
});
}
};
}]);
Element :
input limit-to="3" type="number" name="performance" class="typo-xl-l input-power">