Skip to content

Comments

Add IE versions for KeyboardEvent API#10381

Merged
foolip merged 1 commit intomdn:mainfrom
queengooborg:api/KeyboardEvent/ie
Jun 29, 2021
Merged

Add IE versions for KeyboardEvent API#10381
foolip merged 1 commit intomdn:mainfrom
queengooborg:api/KeyboardEvent/ie

Conversation

@queengooborg
Copy link
Contributor

This PR adds real values for Internet Explorer and Edge for the KeyboardEvent API, based upon results from the mdn-bcd-collector project (v3.0.2). Results are manually confirmed for accuracy.

Tests Used: https://mdn-bcd-collector.appspot.com/tests/api/KeyboardEvent

This PR adds real values for Internet Explorer and Edge for the `KeyboardEvent` API, based upon results from the [mdn-bcd-collector](https://mdn-bcd-collector.appspot.com) project (v3.0.2).  Results are manually confirmed for accuracy.

Tests Used: https://mdn-bcd-collector.appspot.com/tests/api/KeyboardEvent
@github-actions github-actions bot added the data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label May 7, 2021
@foolip foolip changed the title Add IE/Edge versions for KeyboardEvent API Add IE versions for KeyboardEvent API May 19, 2021
@foolip
Copy link
Contributor

foolip commented May 19, 2021

This seems suspicious. Keyboard events of some kind must have been supported since IE 4 and maybe earlier. Can you do some digging?

@queengooborg
Copy link
Contributor Author

Running a little test code (see below), it isn't until IE 9 that I see the event argument to onkeydown being an event, let alone a KeyboardEvent. In IE 8 and below, it is undefined.

document.onkeydown = function(event) {
  alert(event);
}

@foolip
Copy link
Contributor

foolip commented Jun 10, 2021

@vinyldarkscratch if you omit the event argument, is alert(event) still undefined? IE4 and later had window.event (per BCD) and maybe the argument just shadows that.

Alternatively, you could try the addEventListener. It looks like the event is fired, just need to see what the event object looks like...

@queengooborg
Copy link
Contributor Author

queengooborg commented Jun 12, 2021

It appears that in IE 10 and below, window.event is some sort of proprietary MSEventObj (but then a regular Event in IE 8), of which I can't get any of the KeyboardEvent properties. Additionally, it seems that the keydown event is only supported in IE 9 and above, despite the fact I'm also using attachEvent for IE 8 and lower, and that onkeydown is present in earlier IE versions.

With all of this in mind, I think that setting this event API to IE 9 is correct.

@foolip
Copy link
Contributor

foolip commented Jun 14, 2021

Thanks @vinyldarkscratch! If we have a lot of event data to work through, and if some big events rewrite was in IE9, maybe we should go with a <=IE9 range and not bother testing earlier. Or just <=IE11 would be fine honestly.

@queengooborg
Copy link
Contributor Author

queengooborg commented Jun 29, 2021

Just checking to see if there's anything I need to do to get this PR ready for merging?

@foolip
Copy link
Contributor

foolip commented Jun 29, 2021

I had suggested a <=9 range, but given that I just merged the MouseEvent PR this seems very plausible too. Nobody will care if it's right anyway, who's supporting IE8 now?

@foolip foolip merged commit 5577b5f into mdn:main Jun 29, 2021
@queengooborg queengooborg deleted the api/KeyboardEvent/ie branch June 29, 2021 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:api Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants