소스 검색

HUE-8727 [frontend] Prevent chrome from autofilling username in select2 search inputs

Johan Ahlen 6 년 전
부모
커밋
56ffd27b40
1개의 변경된 파일5개의 추가작업 그리고 0개의 파일을 삭제
  1. 5 0
      desktop/core/src/desktop/js/ko/bindings/ko.select2.js

+ 5 - 0
desktop/core/src/desktop/js/ko/bindings/ko.select2.js

@@ -199,6 +199,11 @@ ko.bindingHandlers.select2 = {
             }
           });
       });
+    $element
+      .data('select2')
+      .search.prop('readOnly', true)
+      .attr('onfocus', 'this.removeAttribute("readonly");')
+      .wrap('<form autocomplete="off">');
   },
   update: function(element, valueAccessor, allBindingsAccessor) {
     if (typeof allBindingsAccessor().visible != 'undefined') {