12 Replies
      Latest reply on Dec 4, 2017 10:48 PM by Zheng Nan
      arupsenmis Level 1 Level 1 (0 points)

        HTML Select Input Dropdown is not getting dismissed properly on iOS 11 beta 5. Upon closing the dropdown, an empty dropdown with blank options reappears in its place.

         

        Note: This issue was resolved in beta 4 but seems to have resurfaced in beta 5

         

        Kindly let me know if this is a known issue and will be fixed in future beta releases or if a workaround is available.

        • Re: iOS11 HTML Select Input Issue
          sravanfromhayathnagar Level 1 Level 1 (0 points)

          Hey I just now found workaround.

          Please build the ipa using xcode 8.If we build ipa using xcode 8 its working fine in iOS11.

          • Re: iOS11 HTML Select Input Issue
            msirisak Level 1 Level 1 (0 points)

            Hello,

             

            Also not working for my side using ios 11.0 and xcode 9

              • Re: iOS11 HTML Select Input Issue
                max532 Level 1 Level 1 (0 points)

                Fix is possible, but required invading into WebKit internals (actually, -[UIWebSelectPopover _userActionDismissedPopover:] method interception and delaying call to accessoryDone).

                  • Re: iOS11 HTML Select Input Issue
                    msirisak Level 1 Level 1 (0 points)

                    Do you have any links or tutorial that would help me achieve that ?

                    Indeed the build with xcode 8 on ios 11 is solving the issue. But i don't think it is a consistent and long term solution. Do you have any idea if it will be fixed in the future xcode 9 versions ? or where can i contact the apple team to keep them aware of this issue. Thanks !

                      • Re: iOS11 HTML Select Input Issue
                        rsindogi Level 1 Level 1 (0 points)

                        We had same problem with HTML select component, we were able resolve this issue by swizzling presentviewcontroller.

                          • Re: iOS11 HTML Select Input Issue
                            jheid Level 1 Level 1 (0 points)

                            Could you please post your solution?

                            • Re: iOS11 HTML Select Input Issue
                              manumqln Level 1 Level 1 (0 points)

                              Is there any solution for this problem?

                              I am also getting this issue in XCode 9.0 and iOS 11.0.3

                                • Re: iOS11 HTML Select Input Issue
                                  ccampos Level 1 Level 1 (0 points)

                                  As posted previously, it seems the current work-around is to build your solution using xcode 8.

                                   

                                  A workaround I am currently looking in to is by using jquery mobile to override the native select box behavior.

                                   

                                  <script src="[path to jquery mobile]"></script>
                                  ...
                                  <select data-native-menu="false">
                                       <option>Option 1</option>
                                       <option>Option 2</option>
                                       ...
                                  </select>
                                  

                                   

                                  Personally, i'm not a huge fan of jQuery mobile, but this does save time versus creating a custom handler in javascipt to handle select boxes. jQuery mobile can be found @ jquerymobile.com

                                   

                                  Another option is that I have heard that using an alternate webview works. I think it is WKWebView or something along those lines. I don't program in xcode, so I am not familiar with it, nor have I dabbled with it.

                                   

                                  Also, not sure if anyone else has mentioned it, but select box behavior seems to be working fine on iPhone devices. iPhones seem to handle the select box differently than their tablet counterparts.

                                   

                                  Hope this helps.

                                  • Re: iOS11 HTML Select Input Issue
                                    rsindogi Level 1 Level 1 (0 points)

                                    Here is the soluntion for all the issue with html select option

                                     

                                    Header file:

                                    #import <Foundation/Foundation.h>
                                    @interface NSObject(SwizzleUIPopOver)
                                    @end
                                    

                                     

                                    Implementation:

                                    #import "NSObject+SwizzleUIPopOver.h"
                                    #import <objc/runtime.h>
                                    @implementation NSObject(SwizzleUIPopOver)
                                    BOOL alreadyloaded=false;
                                    +(void)load {
                                        static dispatch_once_t onceToken;
                                    
                                        dispatch_once(&onceToken, ^{
                                       
                                            Class class = [self class];
                                       
                                            int numClasses = objc_getClassList(NULL, 0);
                                            Class *classes = NULL;
                                       
                                            /
                                            /
                                            classes = (__unsafe_unretained Class *)malloc(sizeof(Class) * numClasses);
                                            numClasses = objc_getClassList(classes, numClasses);
                                            for (NSInteger i = 0; i < numClasses; i++)
                                            {
                                                Class superClass = classes[i];
                                                const char * name=class_getName(classes[i]);
                                                NSString *nameOfClass=[NSString stringWithUTF8String:name];
                                                if([nameOfClass isEqual:@"UIWebSelectPopover"])
                                                {
                                                    do
                                                    {
                                                        superClass = class_getSuperclass(superClass);
                                                    } while(superClass && superClass != class);
                                               
                                                    if (superClass == nil)
                                                    {
                                                        continue;
                                                    }
                                                    [self swizzleClassWithUserActionDismissedPopover:classes[i]];
                                                }
                                                else if([nameOfClass isEqual:@"UIWebFormRotatingAccessoryPopover"])
                                                {
                                                    do
                                                    {
                                                        superClass = class_getSuperclass(superClass);
                                                    } while(superClass && superClass != class);
                                               
                                                    if (superClass == nil)
                                                    {
                                                        continue;
                                                    }
                                                    [self swizzleClassWithAccessporyDone:classes[i]];
                                                }
                                           
                                            }
                                       
                                            free(classes);
                                        });
                                    }
                                    -(void)byPass_accessoryDone{
                                        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
                                            [self byPass_accessoryDone];
                                        });
                                    }
                                    -(void)byPass_userActionDismissedPopover:(id)arg1{
                                        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, .5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
                                            [self byPass_accessoryDone];
                                        });
                                    }
                                    + (void)swizzleClassWithAccessporyDone:(Class)class
                                    {
                                        /
                                        SEL originalShouldSelector = @selector(accessoryDone);
                                        SEL swizzledShouldSelector = @selector(byPass_accessoryDone);
                                    
                                        Method originalShouldMethod = class_getInstanceMethod(class, originalShouldSelector);
                                        Method swizzledShouldMethod = class_getInstanceMethod(class, swizzledShouldSelector);
                                    
                                        BOOL didAddShouldMethod = class_addMethod(class, originalShouldSelector, method_getImplementation(swizzledShouldMethod), method_getTypeEncoding(swizzledShouldMethod));
                                    
                                        if (didAddShouldMethod) {
                                            class_replaceMethod(class, swizzledShouldSelector, method_getImplementation(originalShouldMethod), method_getTypeEncoding(originalShouldMethod));
                                        }
                                        else {
                                            method_exchangeImplementations(originalShouldMethod, swizzledShouldMethod);
                                        }
                                    }
                                    +(void)swizzleClassWithUserActionDismissedPopover:(Class) class{
                                        SEL originalSelector = @selector(_userActionDismissedPopover:);
                                        SEL swizzledSelector = @selector(byPass_userActionDismissedPopover:);
                                    
                                        Method originalMethod = class_getInstanceMethod(class, originalSelector);
                                        Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
                                    
                                        BOOL didAddMethod = class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod));
                                    
                                        if (didAddMethod) {
                                            class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
                                        }
                                        else {
                                            method_exchangeImplementations(originalMethod, swizzledMethod);
                                        }
                                    }
                                    @end
                                    
                                    
                                    

                                     

                                     

                                    But this the swizzle mehtod. works like a charm on our enterprise application

                          • Re: iOS11 HTML Select Input Issue
                            Zheng Nan Level 1 Level 1 (0 points)

                            This bug working fine in iOS 11.2.