Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tabs (again) #16

Open
sdmonkey opened this issue Apr 10, 2014 · 0 comments
Open

Tabs (again) #16

sdmonkey opened this issue Apr 10, 2014 · 0 comments

Comments

@sdmonkey
Copy link

I hope its OK to post this here... I saw other posts regarding the use of the TAB so I figured I'd post a new item instead of commenting in one of the older issues; especially since they have been closed..?

Essentially, I would like to change two things.1. Stop giving focus to the cloned 'hint' node. 2. Be able to move beyond the txtInput field after I have accepted a value; using the TAB.

This could be accomplished by:
Adding this attribute def.

txtHint.tabIndex = '-1'; // won't work in all browsers...http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 

Adding this var before the keyDownHandler

var lastKeyHandled = ''; // see if stmt below

And replacing this:

if (keyCode == 9) { // for tabs we need to ensure that we override the default behaviour: move to the next focusable HTML-element 
                e.preventDefault();
                e.stopPropagation();
                if (txtHint.value.length == 0) {
                    rs.onTab(); // tab was called with no action.
                                // users might want to re-enable its default behaviour or handle the call somehow.
                }
            }

With this:

if (keyCode == 9) { // for tabs we need to ensure that we override the default behaviour: move to the next focusable HTML-element 
               if(keyCode != lastKeyHandled){ // if the tab was the last keyCode handled, allow movement to next tab index item
                  if ( e.preventDefault ) e.preventDefault();
                  //e.preventDefault(); IE Error
                  if ( e.stopPropagation ) e.stopPropagation();
                  //e.stopPropagation(); IE Error
                  if (txtHint.value.length == 0) {
                    rs.onTab(); // tab was called with no action.
                                // users might want to re-enable its default behaviour or handle the call somehow.
                  }
               }
            }
            lastKeyHandled = keyCode; //
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant