This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Pages: 1 - Last Post: 14 Jan 17, 21:52 Last Post By: JeffTucker
Dschuwi

Posts: 296
Registered: 12-Nov-2003
Keyboard navigation / key detection browser compatibility
Posted: 12 Jan 17, 21:59
 
  Click to reply to this thread Reply
My skin has been using keyboard navigation for years, with code borrowed and put together from quite some sources, and it used to work on major browsers according to various testers.

I thought it might be time to update the code, after reading that KeyboardEvent.keyCode is depracted and "may cease to work at any time" according to here

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode

One should use KeyboardEvent.code instead, but "Unfortunately, some browsers still don't have it, so you'll have to be careful to make sure you use one which is supported on all target browsers. Google Chrome and Safari have implemented KeyboardEvent.keyIdentifier, which was defined in a draft specification but not the final spec."

Does someone have experience with a proper up-to-date and cross-browser compatible key detection routine?
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: Keyboard navigation / key detection browser compatibility
Posted: 14 Jan 17, 21:52   in response to: Dschuwi in response to: Dschuwi
 
  Click to reply to this thread Reply
I see no one has responded to this. I did a little poking around, and it seems that for now, it's probably best to stick to "tried and true." The routine that's included in Minimal is as good as any.

Apparently, keyCode has been deprecated for years. Most of the posts I've seen about it elsewhere say, in effect, "screw 'em - if they can't give me a cross-browser solution that works, I'll stick with what I've got." ;)
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums