Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

input not selected when focused using tab #118

Open
2 of 8 tasks
gest01 opened this issue Oct 20, 2016 · 2 comments
Open
2 of 8 tasks

input not selected when focused using tab #118

gest01 opened this issue Oct 20, 2016 · 2 comments
Labels

Comments

@gest01
Copy link

gest01 commented Oct 20, 2016

Description

When input has focus using tab key, the content of the input is not selected. Instead, the cursor is set to the end of the input value.

Expected outcome

As soon the input is focused (using the tab key), the content of the input should be fully selected

Actual outcome

the cursor is set to the end of the input value.

Steps to reproduce

  1. https://jsbin.com/niwugeyice/1/edit?html,output
  2. Click with the mouse into input 'txt1'
  3. press tab
  4. txt2 receives the focus, but nothing is selected

Browsers Affected

  • Chrome
  • Firefox
  • Safari 8
  • Safari 9
  • Safari 7
  • Edge
  • IE 11
  • IE 10

Works in Firefox and Edge

@aguirrel
Copy link
Collaborator

Yes you are right. It's a side effect for customize 'focus' evento to convert from currency view to only numeric view. I will check it. Thanks a lot!

@ztgluis
Copy link

ztgluis commented Apr 25, 2017

Might not be the most elegant solution, but for now I found a workaround by adding a decorator to the link function on my app config:

    .config(function($provide) {
        $provide.decorator('ngCurrencyDirective', function($delegate) {
            var directive = $delegate[0];
            directive.compile = function(){
                return function(scope, element, attrs){
                    directive.link.apply(this, arguments);
                    element.on('focus',function(){
                        element.select();
                    });
                };
            };
            return $delegate;
        });
    })

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

No branches or pull requests

4 participants