防止jquery-在输入元素中输入文本后华为手机的移动弹出窗口重新定位

Prevent jquery-mobile popup repositions for Huawei phones after text is entered to an input element

在我们的项目中,我们使用 jquery-mobile popup dialog

显示对话框后,我第一次尝试在 phone 上填写文本(Huawei P9 lite,Android 6.0.0,Chrome 55.0.2883.91 ),弹出窗口关闭并重新打开。

即使在演示 Form 弹出窗口中,我也能够重现此问题。

在屏幕更大且几乎相同的设备(5.7 英寸对 5 英寸)上 android(6.0.1,相同的浏览器)不会发生这种情况。

好像是键盘出现后popup自动重新定位造成的。有人遇到过类似的问题吗?你是怎么解决的?

<a href="#popupLogin" data-rel="popup" data-position-to="window" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-icon-check ui-btn-icon-left ui-btn-a" data-transition="pop">Sign in</a>
<div data-role="popup" id="popupLogin" data-theme="a" class="ui-corner-all">
    <form>
        <div style="padding:10px 20px;">
            <h3>Please sign in</h3>
            <label for="un" class="ui-hidden-accessible">Username:</label>
            <input type="text" name="user" id="un" value="" placeholder="username" data-theme="a">
            <label for="pw" class="ui-hidden-accessible">Password:</label>
            <input type="password" name="pass" id="pw" value="" placeholder="password" data-theme="a">
            <button type="submit" class="ui-btn ui-corner-all ui-shadow ui-btn-b ui-btn-icon-left ui-icon-check">Sign in</button>
        </div>
    </form>
</div>

答案基于奥马尔的评论。一旦我注释了以下代码行,该行为就不会出现(可能会丢失一个很好的重新定位功能)。

_handleWindowResize: function(/* theEvent */) {
    if ( this._isOpen && this._ignoreResizeTo === 0 ) {
        if ( ( this._expectResizeEvent() || this._orientationchangeInProgress ) &&
            !this._ui.container.hasClass( "ui-popup-hidden" ) ) {
            // effectively rapid-close the popup while leaving the screen intact
            // this._ui.container
            //  .addClass( "ui-popup-hidden ui-popup-truncate" )
            //  .removeAttr( "style" );
        }
    }
},