Compare commits

..

2 Commits

Author SHA1 Message Date
Zeno Rocha
b6e6b80ab0 Release v1.7.1 2017-05-29 16:57:52 -07:00
Patrick H. Lauke
a55c9ac513 Move focus to trigger instead of simply blur()ing (#419)
blur() results in a loss/reset of keyboard focus, meaning keyboard users usually get thrown right back to the start of the page. Instead, this moves focus back to the trigger (which had the focus when the trigger was activated).
As with the proposed fix in https://github.com/zenorocha/clipboard.js/pull/418 this obviously results in the focus styles (like the default outline, unless suppressed) being applied to the trigger (see the related PR for rationale and future fix using `:focus-ring`)
2017-05-29 16:54:55 -07:00
6 changed files with 11 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "clipboard",
"version": "1.7.0",
"version": "1.7.1",
"description": "Modern copy to clipboard. No Flash. Just 2kb",
"license": "MIT",
"main": "dist/clipboard.js",

6
dist/clipboard.js vendored
View File

@@ -1,5 +1,5 @@
/*!
* clipboard.js v1.7.0
* clipboard.js v1.7.1
* https://zenorocha.github.io/clipboard.js
*
* Licensed MIT © Zeno Rocha
@@ -522,8 +522,8 @@ module.exports = E;
}, {
key: 'clearSelection',
value: function clearSelection() {
if (this.target) {
this.target.blur();
if (this.trigger) {
this.trigger.focus();
}
window.getSelection().removeAllRanges();

File diff suppressed because one or more lines are too long

View File

@@ -3,7 +3,7 @@
Package.describe({
name: "zenorocha:clipboard",
summary: "Modern copy to clipboard. No Flash. Just 2kb.",
version: "1.7.0",
version: "1.7.1",
git: "https://github.com/zenorocha/clipboard.js"
});

View File

@@ -1,6 +1,6 @@
{
"name": "clipboard",
"version": "1.7.0",
"version": "1.7.1",
"description": "Modern copy to clipboard. No Flash. Just 2kb",
"repository": "zenorocha/clipboard.js",
"license": "MIT",

View File

@@ -131,11 +131,11 @@ class ClipboardAction {
}
/**
* Removes current selection and focus from `target` element.
* Moves focus away from `target` and back to the trigger, removes current selection.
*/
clearSelection() {
if (this.target) {
this.target.blur();
if (this.trigger) {
this.trigger.focus();
}
window.getSelection().removeAllRanges();