為了改善您的使用體驗,本網站正在進行維護,部分功能暫時無法使用。若本站的文件無法解決您的問題,想要向社群發問的話,請到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 發問,我們的社群成員將很快會回覆您的疑問。

搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

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

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.