Task #12725

Update deprecated keyboard handling events in JS

Added by Dan Gillean 9 months ago. Updated about 1 month ago.

Status:VerifiedStart date:01/17/2019
Priority:MediumDue date:
Assignee:-% Done:

0%

Category:Internals
Target version:Release 2.6.0
Google Code Legacy ID: Tested version:2.4, 2.5
Sponsored:No Requires documentation:

Description

Related to a user forum thread discussion, 2018-01-15: https://groups.google.com/d/msg/ica-atom-users/dxd5atjGvso/v194ABlICgAJ

We currently use "keypress" to respond to user keyboard input in the global search box, for allowing using the arrow keys to navigate the drop-down menu. In issue #11944 we fixed a small bug in relation to this.

However, through the forum discussion, it's been brought to our attention that keypress is now deprecated, and should likely be updated. See for example:

Alternatives

beforeinput is still considered experimental - though support has been implemented in WebKit based browsers like Chrome and Safari, it may be too soon for users with older browsers. However, we could use keydown:

There are other deprecated event calls in our JS code as well. From the forum:

Adding to this, there are other deprecations: "keyboardEvent.keyCode" or "keyboardEvent.which", for instance, should be replaced by "keyboardEvent.key" (and those are used in this file as well).

We should review our JS code and update these deprecated event calls.


Related issues

Related to Access to Memory (AtoM) - Bug #11944: Users cannot enter ampersand character into global search... Verified 02/01/2018
Related to Access to Memory (AtoM) - Bug #12967: Global search box keyboard navigation not working Verified 04/22/2019

History

#1 Updated by Dan Gillean 9 months ago

  • Related to Bug #11944: Users cannot enter ampersand character into global search box added

#2 Updated by Dan Gillean 4 months ago

  • Related to Bug #12967: Global search box keyboard navigation not working added

#3 Updated by Mike Cantelon 2 months ago

The keyCode event property is also deprecated:

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

Switching to use of which, which jQuery will set even if a browser still only uses keyCode:

https://stackoverflow.com/questions/4471582/keycode-vs-which

#4 Updated by Mike Cantelon about 1 month ago

  • Status changed from New to In progress
  • Assignee set to Mike Cantelon

I've got a PR ready but am going to test it in Windows before submitting it for code review.

#5 Updated by Mike Cantelon about 1 month ago

  • Status changed from In progress to Code Review
  • Assignee deleted (Mike Cantelon)

#6 Updated by Steve Breker about 1 month ago

  • Status changed from Code Review to Feedback
  • Assignee set to Mike Cantelon

Code review complete. I'm no JS expert though! ;)

Looks like great updates to the code.

#7 Updated by Mike Cantelon about 1 month ago

  • Status changed from Feedback to QA/Review
  • Assignee deleted (Mike Cantelon)

Thanks Steve!

Merged into qa/2.6.x.

#8 Updated by Dan Gillean about 1 month ago

  • Status changed from QA/Review to Verified
  • Target version set to Release 2.6.0

anyway, keyboard navigation is working well!

Also available in: Atom PDF