Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

ابحث في الدعم

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

override default behaviour of left and right keyboard keys when focus is on a select control

  • 1 (رد واحد)
  • 1 has this problem
  • 1 view
  • آخر ردّ كتبه the-edmeister

more options

I am trying to create Excel-like navigation of editable table data (move around with UP, DOWN, LEFT, RIGHT arrow keys) that is setting in a regular HTML table, but the type of fields can be the textfield, textarea, select (drop-down list), or check-boxes. I currently have enabled and call a javascript function that will check to see if UP, DOWN, LEFT, RIGHT keys were pressed and re-focus the selected field to the appropriate one.

All works well, EXCEPT when I navigate over a select (drop-down box). In addition to my event firing for my javascript function, it seems that inside of firefox the control widget also receives the key and performs its default behaviour. In Firefox, this behaviour seems to be to switch the selected option in the drop-down box, however I would not want this to occur in my case since all I want to occur is for the focus to move to the next editable element from any direction.

I could actually do fine with the UP, DOWN keys changing the Select's chosen option, but I need LEFT / RIGHT to only shift focus LEFT or RIGHT.

Is there anyway to shut this off (or override it)?

I am trying to create Excel-like navigation of editable table data (move around with UP, DOWN, LEFT, RIGHT arrow keys) that is setting in a regular HTML table, but the type of fields can be the textfield, textarea, select (drop-down list), or check-boxes. I currently have enabled and call a javascript function that will check to see if UP, DOWN, LEFT, RIGHT keys were pressed and re-focus the selected field to the appropriate one. All works well, EXCEPT when I navigate over a select (drop-down box). In addition to my event firing for my javascript function, it seems that inside of firefox the control widget also receives the key and performs its default behaviour. In Firefox, this behaviour seems to be to switch the selected option in the drop-down box, however I would not want this to occur in my case since all I want to occur is for the focus to move to the next editable element from any direction. I could actually do fine with the UP, DOWN keys changing the Select's chosen option, but I need LEFT / RIGHT to only shift focus LEFT or RIGHT. Is there anyway to shut this off (or override it)?

All Replies (1)

more options

Try posting at the Web Development / Standards Evangelism forum at MozillaZine. The helpers over there are more knowledgeable about web page development issues with Firefox.
http://forums.mozillazine.org/viewforum.php?f=25
You'll need to register and login to be able to post in that forum.