Skip to content
This repository has been archived by the owner on Nov 9, 2024. It is now read-only.

Commit

Permalink
2.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Jan 31, 2018
1 parent bea2882 commit d7dd475
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 51 deletions.
30 changes: 15 additions & 15 deletions dist/tippy.all.js
Original file line number Diff line number Diff line change
Expand Up @@ -3003,17 +3003,6 @@ function computeArrowTransform(popper, arrow, arrowTransform) {
arrow.style[prefix('transform')] = computedTransform;
}

/**
* Determines if an element is visible in the viewport
* @param {Element} el
* @return {Boolean}
*/
function elementIsInViewport(el) {
var rect = el.getBoundingClientRect();

return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
}

/**
* Returns the distance taking into account the default distance due to
* the transform: translate setting in CSS
Expand Down Expand Up @@ -3112,6 +3101,17 @@ function reflow(popper) {
void popper.offsetHeight;
}

/**
* Focuses an element while preventing a scroll jump if it's not entirely within the viewport
* @param {Element} el
*/
function focus(el) {
var x = window.scrollX || window.pageXOffset;
var y = window.scrollY || window.pageYOffset;
el.focus();
scroll(x, y);
}

var T = (function () {
var key = {};
var store = function store(data) {
Expand Down Expand Up @@ -3252,8 +3252,8 @@ var T = (function () {
tooltip.classList.add('tippy-notransition');
}

if (options.interactive && elementIsInViewport(reference)) {
popper.focus();
if (options.interactive) {
focus(popper);
}

reference.setAttribute('aria-describedby', 'tippy-' + _this.id);
Expand Down Expand Up @@ -3305,8 +3305,8 @@ var T = (function () {

setVisibilityState([tooltip, backdrop], 'hidden');

if (options.interactive && options.trigger.indexOf('click') > -1 && elementIsInViewport(reference)) {
reference.focus();
if (options.interactive && options.trigger.indexOf('click') > -1) {
focus(reference);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion dist/tippy.all.min.js

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions dist/tippy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3001,17 +3001,6 @@ function computeArrowTransform(popper, arrow, arrowTransform) {
arrow.style[prefix('transform')] = computedTransform;
}

/**
* Determines if an element is visible in the viewport
* @param {Element} el
* @return {Boolean}
*/
function elementIsInViewport(el) {
var rect = el.getBoundingClientRect();

return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
}

/**
* Returns the distance taking into account the default distance due to
* the transform: translate setting in CSS
Expand Down Expand Up @@ -3110,6 +3099,17 @@ function reflow(popper) {
void popper.offsetHeight;
}

/**
* Focuses an element while preventing a scroll jump if it's not entirely within the viewport
* @param {Element} el
*/
function focus(el) {
var x = window.scrollX || window.pageXOffset;
var y = window.scrollY || window.pageYOffset;
el.focus();
scroll(x, y);
}

var T = (function () {
var key = {};
var store = function store(data) {
Expand Down Expand Up @@ -3250,8 +3250,8 @@ var T = (function () {
tooltip.classList.add('tippy-notransition');
}

if (options.interactive && elementIsInViewport(reference)) {
popper.focus();
if (options.interactive) {
focus(popper);
}

reference.setAttribute('aria-describedby', 'tippy-' + _this.id);
Expand Down Expand Up @@ -3303,8 +3303,8 @@ var T = (function () {

setVisibilityState([tooltip, backdrop], 'hidden');

if (options.interactive && options.trigger.indexOf('click') > -1 && elementIsInViewport(reference)) {
reference.focus();
if (options.interactive && options.trigger.indexOf('click') > -1) {
focus(reference);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion dist/tippy.min.js

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions dist/tippy.standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,17 +574,6 @@ function computeArrowTransform(popper, arrow, arrowTransform) {
arrow.style[prefix('transform')] = computedTransform;
}

/**
* Determines if an element is visible in the viewport
* @param {Element} el
* @return {Boolean}
*/
function elementIsInViewport(el) {
var rect = el.getBoundingClientRect();

return rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth);
}

/**
* Returns the distance taking into account the default distance due to
* the transform: translate setting in CSS
Expand Down Expand Up @@ -683,6 +672,17 @@ function reflow(popper) {
void popper.offsetHeight;
}

/**
* Focuses an element while preventing a scroll jump if it's not entirely within the viewport
* @param {Element} el
*/
function focus(el) {
var x = window.scrollX || window.pageXOffset;
var y = window.scrollY || window.pageYOffset;
el.focus();
scroll(x, y);
}

var T = (function () {
var key = {};
var store = function store(data) {
Expand Down Expand Up @@ -823,8 +823,8 @@ var T = (function () {
tooltip.classList.add('tippy-notransition');
}

if (options.interactive && elementIsInViewport(reference)) {
popper.focus();
if (options.interactive) {
focus(popper);
}

reference.setAttribute('aria-describedby', 'tippy-' + _this.id);
Expand Down Expand Up @@ -876,8 +876,8 @@ var T = (function () {

setVisibilityState([tooltip, backdrop], 'hidden');

if (options.interactive && options.trigger.indexOf('click') > -1 && elementIsInViewport(reference)) {
reference.focus();
if (options.interactive && options.trigger.indexOf('click') > -1) {
focus(reference);
}

/*
Expand Down
2 changes: 1 addition & 1 deletion dist/tippy.standalone.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/tippy/tippy.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tippy.js",
"version": "2.1.0",
"version": "2.1.1",
"description": "Vanilla JS Tooltip Library",
"main": "dist/tippy.all.js",
"repository": {
Expand All @@ -15,7 +15,8 @@
"rollup -c scripts/rollup.bundle.config.js && rollup -c scripts/rollup.bundle.min.config.js",
"standalone":
"rollup -c scripts/rollup.standalone.config.js && rollup -c scripts/rollup.standalone.min.config.js",
"themes": "rollup -c scripts/themes/rollup.light.config.js && rollup -c scripts/themes/rollup.translucent.config.js",
"themes":
"rollup -c scripts/themes/rollup.light.config.js && rollup -c scripts/themes/rollup.translucent.config.js",
"test": "eslint 'src/**/*.js'",
"prettier": "prettier --print-width 100 --no-semi --single-quote es5 --write 'src/**/*.js'"
},
Expand Down

0 comments on commit d7dd475

Please sign in to comment.