WICG / inert

Polyfill for the inert attribute and property.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

In IE10, readyState is sometimes incorrect and inert tries to observe a document.body which is null

ryanthemanuel opened this issue · comments

In IE10, readyState is sometimes incorrect and inert tries to observe a document.body which is null. Possibly this is similar to what is being described in #75.

Basically, from what I can tell, https://github.com/WICG/inert/blob/master/src/inert.js#L481 is flagged incorrectly, and as a result, https://github.com/WICG/inert/blob/master/src/inert.js#L589 crashes due to document.body being null. I see in the comment here: https://github.com/WICG/inert/blob/master/src/inert.js#L588 that this is not always needed (and is actually not in my team's particular case). Is there a way we could expose a way to programmatically disable the document.body functionality?

Hey @ryanthemanuel can you tell me how you're loading the polyfill? Is it in the <head> or the end of the <body>. Is it inside of a module of any kind like AMD or a webpack bundle. Just curious about other factors that might lead to this.

@robdodson It's in the head and in a webpack bundle due to the legacy nature of some of the code I'm dealing with.

@robdodson or anyone else, any thoughts on this?

I'm also seeing this issue. We are seeing it when using inert in react code for modal accessibility. I see there is some IE specific code & IE 9 & 10 can be buggy about setting document.readyState = interactive at time. Would it be worth adding an IE check for complete state for IE?

@robdodson any more traction with this?

I'll see if @alice and I can chat about it this week. Sorry for the lag.

commented

Just making sure I understand, the problem is that on line 483:

    if (document.readyState === 'loading') {

... this check often fails spuriously in IE?

Is the readyState some other non-ready value in those cases?

btw we just landed a PR (#145) which may help with this... could folks give v3.0.2 a shot to see if it resolves the issue?

Fixes it for me

@ryanthemanuel can we close this?

const a=document. createElement ('p');
a.textContent='ffffffff';
document.body.appendChild(a);