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

add 1..9 hotkeys #689

Closed
wants to merge 1 commit into from
Closed

add 1..9 hotkeys #689

wants to merge 1 commit into from

Conversation

dutzi
Copy link

@dutzi dutzi commented Jun 21, 2021

This PR adds a keyboard shortcut to copy one of the codes.

Open the popup, hit 1, 2, ... 9 to copy the first, second, etc... codes that are listed.

}

codeClipboard.value =
instance.$store.state.accounts.entries[index - 1].code;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index here could be zero, and index - 1 could be -1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instance.$store.state.accounts.entries could not be shown by sort of the index in UI. Some accounts may be pinned, some accounts may be filtered.
Here's how are entries rendered: https://github.com/Authenticator-Extension/Authenticator/blob/dev/src/components/Popup/MainBody.vue#L26-L40

@dutzi
Copy link
Author

dutzi commented Jun 21, 2021 via email

@dutzi
Copy link
Author

dutzi commented Jun 21, 2021 via email

Comment on lines +152 to +153
document.activeElement?.nodeName === "INPUT" ||
document.activeElement?.nodeName === "TEXTAREA"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there's a better way to handle this. But obviously, editable div is not included, and read-only input, read-only textarea, radio and checkbox are not excluded.

@dutzi
Copy link
Author

dutzi commented Jun 21, 2021 via email

@Sneezry
Copy link
Member

Sneezry commented Jun 21, 2021

Right. Maybe stopPropagation on each input?

The sample code is not awesome, but it works: https://jsbin.com/vevovuyefu/edit?html,js,console,output

@Sneezry
Copy link
Member

Sneezry commented Aug 23, 2021

Closing in favor of #691

Feel free to reopen this PR if you believe it is closed by mistake.

@Sneezry Sneezry closed this Aug 23, 2021
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

Successfully merging this pull request may close these issues.

2 participants