vue-clipboard2 icon indicating copy to clipboard operation
vue-clipboard2 copied to clipboard

Focus must stay on the link/button

Open PVince81 opened this issue 4 years ago • 1 comments

Steps to reproduce

  1. Run the sample app
  2. Focus on the text field
  3. Now tab to the "Copy Text" button

Expected result

Keyboard focus stays on "Copy Text"

Actual result

Focus moves to the next field.

Version

Happens on vue-clipboard2 git master 8a542c558c6857212d06f6fc1929384a5b5104cc and also on version 0.3.1

Further notes

If you remove the "v-clipboard:copy" attribute and retest you can see that the focus stays.

The problem also happens when using $copyText.

PVince81 avatar Nov 20 '20 10:11 PVince81

I have the same issue, a workaround is to reset the focus on the text field after copy.

  this.$copyText('my content').then(() => {
    this.$refs.mytextFieldInput.focus();
  });

brd6 avatar Mar 02 '21 10:03 brd6