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

grid cell loses focus after apply edit(enter or escape) forcing user to use mouse instead of keyboard navigation #263

Closed
tharry opened this issue Aug 25, 2012 · 2 comments

Comments

@tharry
Copy link

tharry commented Aug 25, 2012

In dgrid/editor.js there is a method for handling enter and escape in grid inline editors, but firing focusNode.blur() causes grid cell to lose focus which is passed to grid(top level) instead. This behavior makes usage of dgrid only with keyboard navigation for traversing and editing data impossible(or user has to mouse click cell every time after pressing enter or escape).

Probably this would fix the problem(I'm not sure if it safe and doesn't create bug somewhere else...):

function dismissOnKey(evt){
        // Contains logic for reacting to enter/escape keypresses to save/cancel edits.
        // Returns boolean specifying whether this key event should dismiss the field.
        var key = evt.keyCode || evt.which;

        if(key == 27){ // escape: revert + dismiss
            reset();
            activeValue = cmp._dgridLastValue;
            //focusNode.blur();
                        node.parentNode.focus();
        }else if(key == 13 && column.dismissOnEnter !== false){ // enter: dismiss
            // FIXME: Opera is "reverting" even in this case
            //focusNode.blur();
                        node.parentNode.focus();
        }
    }

Also in terms of keyboard navigation and in-line editing is there a proper way to make cell editor act like "text select all" after gaining focus?

ghost pushed a commit that referenced this issue Aug 29, 2013
@kfranqueiro
Copy link
Member

I've committed a change that implements this for most cases. However, I've noticed that the combination of old IE (especially < 8) and Dijit widget editors seems to still have some sort of problem, which we'll have to investigate further later.

RE the question of selecting all text when gaining focus, dijit/form/TextBox has a selectOnClick property you can set to true to do this; however, someone noticed that code in dgrid is blocking this from working (see #704).

@kfranqueiro
Copy link
Member

Given that dgrid 0.4 will be dropping support for IE < 8, I'm going to go ahead and close this since we resolved it everywhere else.

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

2 participants