-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Description
What problem does this feature solve?
There is a bug in the current version of Microsoft Edge that causes an "Unspecified error" when accessing document.activeElement inside an iframe. There are two calls accessing activeElement in vue's code base. One of them is triggering the MS Edge issue in one of my projects. I believe this issue was introduced here:
be9210f#diff-7cb22b67c6250cfa775a3cfb6471b700R60
I reported the MS Edge bug to Microsoft and they are going to release a fix in a future release. See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12733599/. In the meantime,I was wondering if you could wrap the .activeElementent calls in a try / catch as a work around.
It seems like IE has had similar issues in the past. The snippet in the sample code I provided in this issue is based on a workaround implemented by JQuery UI. See: https://www.tjvantoll.com/2013/08/30/bugs-with-document-activeelement-in-internet-explorer/. I wouldn't be surprised if similar issues are still lurking on other MS browsers.
Implementing this workaround in vue will help to avoid this issue on current MS Edge (or other MS browser versions with similar issues).
What does the proposed API look like?
var activeElement;
try {
activeElement = document.activeElement;
} catch( error ) {
activeElement = document.body;
}