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

Not Selecting On Tab to Numeric Field #54

Open
rdy2018 opened this issue Jan 22, 2018 · 1 comment
Open

Not Selecting On Tab to Numeric Field #54

rdy2018 opened this issue Jan 22, 2018 · 1 comment
Labels

Comments

@rdy2018
Copy link

rdy2018 commented Jan 22, 2018

Normally, when you use tab to go to the next field, it will select all the text inside the field. But if the numeric field needs to unformat the value, it would not select the text.

Expected Behavior

image
As seen in the screenshot, it will select all the text inside the field.

Actual Behavior

image

Since it needs to unformat the number, it didn't select the text inside and the cursor is at the rightmost.

Specifications

  • Plugin Version: ^2.2.4
  • Vue.js Version: ^2.1.10
  • Browser: Google Chrome
  • OS: MacOS High Sierra
@kevinongko kevinongko added the bug label Jan 26, 2018
@WulfP
Copy link

WulfP commented Jan 4, 2019

I'd like to propose the following patch:

add

this.$nextTick(function () {
    this.$el.select()
})

here

    /**
     * Handle focus event.
     * @param {Object} e
     */
    onFocusHandler (e) {
      this.$emit('focus', e)
      if (this.valueNumber === 0) {
        this.amount = null
      } else {
        this.amount = accounting.formatMoney(this.valueNumber, {
          symbol: '',
          format: '%v',
          thousand: '',
          decimal: this.decimalSeparatorSymbol,
          precision: Number(this.precision)
        })
        this.$nextTick(function () {
          this.$el.select()
        })
      }
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants