Compare commits

...

5 Commits
v1.7.0 ... 2.0

Author SHA1 Message Date
Lucas Bento
0c3bce265f Fix GitHub Primer tooltips link (#479) 2017-10-16 07:25:57 -07:00
Zeno Rocha
3c0dfe5a38 Adds docs on tooltips #423 2017-06-30 16:30:30 -03:00
Nathan
f960b0d20a use only ID name for DOM (#431) 2017-06-30 15:52:07 -03:00
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
7 changed files with 19 additions and 13 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

@@ -119,7 +119,13 @@ clipboard.on('error', function(e) {
});
```
For a live demonstration, open this [site](https://clipboardjs.com/) and just your console :)
For a live demonstration, go to this [site](https://clipboardjs.com/) and open your console.
## Tooltips
Each application has different design needs, that's why clipboard.js does not include any CSS or built-in tooltip solution.
The tooltips you see on the [demo site](https://clipboardjs.com/) were built using [GitHub's Primer](https://github.com/primer/primer-css/tree/master/modules/primer-tooltips). You may want to check that out if you're looking for a similar look and feel.
## Advanced Options
@@ -149,7 +155,7 @@ For use in Bootstrap Modals or with any other library that changes the focus you
```js
new Clipboard('.btn', {
container: document.getElementById('#modal')
container: document.getElementById('modal')
});
```

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();