-
Notifications
You must be signed in to change notification settings - Fork 26
Fix error when navigating past end of tags #23
base: master
Are you sure you want to change the base?
Conversation
When using the arrow key to select tags, if you arrow past the last or first tag a javascript error occurs "Uncaught TypeError: Cannot read property 'target' of undefined "
Looks good to me 👍 . I mean, I'd prefer to just check at the top for no What do you think @dansnetwork ? |
Return right away if ev is null
I just changed my repo to return early and skip the focus. It changes the behavior to stop and the end tags instead of turning to a cursor. Not sure which behavior is desired. |
@@ -460,6 +460,8 @@ | |||
}, | |||
|
|||
_focus : function(ev) { | |||
if(!ev) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indentation here is all wacky. And please always use { .. }
with if statements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, before the return, you should do this.elements.input.focus();
like the original code path did.
The desired behavior is that it returns focus to the |
If we just wish to focus why do we even need these lines? $closest = $(ev.target).closest('li'),
$data = $closest.data('ui-inputosaurus') || $closest.data('inputosaurus');
if(!ev || !$data){ Instead _focus : function(ev) {
var widget = (ev && ev.data.widget) || this;
widget.elements.input.focus();
}, As for the indentation, my editor is set to use spaces instead of tabs. I'll update my source |
When using the arrow key to select tags, if you arrow past the last or
first tag a javascript error occurs "Uncaught TypeError: Cannot read
property 'target' of undefined "