@@ -103,14 +103,10 @@ export const __meta__ = {
103103 . on ( "input" + ns , that . _search . bind ( that ) )
104104 . on ( "paste" + ns , that . _search . bind ( that ) )
105105 . on ( "focus" + ns , function ( e ) {
106- if ( that . _hasActionSheet ( ) ) {
107- that . element . attr ( "readonly" , true ) ;
108- } else if ( ! that . options . readonly ) {
109- that . element . removeAttr ( "readonly" ) ;
110- }
111106 that . _prev = that . _accessor ( ) ;
112107 that . _oldText = that . _prev ;
113108 that . _placeholder ( false ) ;
109+
114110 wrapper . addClass ( FOCUSED ) ;
115111 } )
116112 . on ( "focusout" + ns , function ( ev ) {
@@ -214,7 +210,13 @@ export const __meta__ = {
214210
215211 that . _unboundClick = true ;
216212 that . element
217- . on ( "click" , function ( ) { that . popup . toggle ( ) ; } ) ;
213+ . on ( "click" , function ( ) {
214+ if ( that . _isEnabled ( ) ) {
215+ that . popup . toggle ( ) ;
216+ } else {
217+ that . popup . close ( ) ;
218+ }
219+ } ) ;
218220
219221 if ( that . filterInput ) {
220222 that . filterInput
@@ -229,28 +231,25 @@ export const __meta__ = {
229231 } ) ;
230232
231233 that . popup . bind ( "activate" , ( ) => {
232- // that.wrapper.off("focusout");
233234 that . filterInput . val ( that . element . val ( ) ) ;
234235 that . filterInput . trigger ( "focus" ) ;
235236 } ) ;
236237 that . popup . bind ( "deactivate" , ( ) => {
237- // that.wrapper.on("focusout", function(ev) {
238- // if ((that.filterInput && ev.relatedTarget === that.filterInput[0]) || !that.wrapper.hasClass(FOCUSED)) {
239- // return;
240- // }
241-
242- // that._change();
243- // that._placeholder();
244- // that.close();
245- // that.wrapper.removeClass(FOCUSED);
246- // });
247-
248- // that.wrapper.focus();
249238 that . element . trigger ( "focus" ) ;
250239 } ) ;
251240 }
252241 } ,
253242
243+ _isEnabled : function ( ) {
244+ const that = this ;
245+ const element = that . element ;
246+
247+ const isReadonly = element . prop ( READONLY ) || Boolean ( that . element . attr ( "readonly" ) ) ;
248+ const isDisabled = element . prop ( DISABLED ) || Boolean ( that . element . attr ( "disabled" ) ) ;
249+
250+ return ! isDisabled && ! isReadonly ;
251+ } ,
252+
254253 _onCloseButtonPressed : function ( ) {
255254 var that = this ;
256255
@@ -720,6 +719,9 @@ export const __meta__ = {
720719 that . _last = key ;
721720
722721 if ( key === keys . DOWN ) {
722+ if ( ! that . _isEnabled ( ) ) {
723+ return ;
724+ }
723725 if ( visible ) {
724726 this . _move ( current ? "focusNext" : "focusFirst" ) ;
725727 } else if ( that . value ( ) ) {
@@ -737,6 +739,9 @@ export const __meta__ = {
737739 }
738740 e . preventDefault ( ) ;
739741 } else if ( key === keys . ESC ) {
742+ if ( ! that . _isEnabled ( ) ) {
743+ return ;
744+ }
740745 if ( visible ) {
741746 e . preventDefault ( ) ;
742747 that . close ( ) ;
0 commit comments