Windows Phone:按下后退按钮时,IE或Edge中缺少模糊事件 [英] Windows Phone: Missing blur event in IE or Edge when back button pressed

查看:77
本文介绍了Windows Phone:按下后退按钮时,IE或Edge中缺少模糊事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下情形与Windows Phone设备(IE或Edge)有关.

The following scenarios are relevant to Windows Phone devices (IE or Edge).

场景1:

如果输入元素具有焦点并且软键盘处于向上状态,则按下硬件后退键会使所聚焦的元素模糊,并根据需要弹出键盘.但是,没有触发相应的模糊事件.

If an input element has the focus and the soft keyboard is up, pressing the hardware back key blurs the focused element and pops down the keyboard as it should. However, there is no corresponding blur event fired.

方案2:

如果输入元素具有焦点并且软键盘处于向上状态,则在输入元素外部轻击会模糊所聚焦的元素,弹出键盘并触发模糊事件.

If an input element has the focus and the soft keyboard is up, tapping outside the input element blurs the focused element, pops down the keyboard and fires a blur event.

问题:

是否有一种方法可以在按下硬件后退键并且输入元素具有焦点时触发模糊事件?

Is there a way to make the blur event fire when the hardware back key is pressed and an input element has the focus?

HTML重现该问题:

<!DOCTYPE html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, user-scalable=no" />
        <title>Blur Test</title>
    </head>
    <body>
        <p>Blur Test</p>
        <input type="text" onblur="alert('onblur');">
    </body>
</html>

使用addEventListener会产生相同的结果.

Using addEventListener produces the same result.

在Nokia Lumia 620上测试.操作系统版本:8.0.10211.204

Tested on a Nokia Lumia 620. OS version: 8.0.10211.204

在Nokia Lumia 640上测试.操作系统版本:8.10.15148.160(Windows Phone 8.1 Update 2-Internet Explorer 11)

Tested on a Nokia Lumia 640. OS version: 8.10.15148.160 (Windows Phone 8.1 Update 2 - Internet Explorer 11)

在Nokia Lumia 635上进行了测试.操作系统版本:10.0.10586.29(Windows 10移动版-Microsoft Edge 13)

Tested on a Nokia Lumia 635. OS version: 10.0.10586.29 (Windows 10 Mobile - Microsoft Edge 13)

推荐答案

因此,在进一步研究之后,我将使用'deactivate'事件而不是'blur'事件.

So, after further investigations I'm going to use the 'deactivate' event instead of the 'blur' event.

停用"事件看起来像是特定于IE的,至少我找不到除MSDN之外的任何文档.

The 'deactivate' event looks like it's IE specific, at least I can't find any docs on it except for MSDN.

这篇关于Windows Phone:按下后退按钮时,IE或Edge中缺少模糊事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆