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!

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

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

  • 1 个回答
  • 1 人有此问题
  • 1 次查看
  • 最后回复者为 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)?

所有回复 (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.