Skip to content

Commit

Permalink
6.10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
limonte committed Oct 7, 2017
1 parent 73743c1 commit 639955b
Show file tree
Hide file tree
Showing 8 changed files with 2,768 additions and 480 deletions.
2 changes: 1 addition & 1 deletion dist/sweetalert2.all.min.js

Large diffs are not rendered by default.

55 changes: 23 additions & 32 deletions dist/sweetalert2.common.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* sweetalert2 v6.10.1
* sweetalert2 v6.10.2
* Released under the MIT License.
*/
'use strict';
Expand Down Expand Up @@ -182,15 +182,6 @@ var states = {
sweetAlert.resetValidationError();
};

input.onkeydown = function (event) {
setTimeout(function () {
if (event.keyCode === 13 && params.allowEnterKey) {
event.stopPropagation();
sweetAlert.clickConfirm();
}
}, 0);
};

file.onchange = function () {
sweetAlert.resetValidationError();
};
Expand Down Expand Up @@ -255,10 +246,6 @@ var getImage = function getImage() {
return elementByClass(swalClasses.image);
};

var getButtonsWrapper = function getButtonsWrapper() {
return elementByClass(swalClasses.buttonswrapper);
};

var getProgressSteps = function getProgressSteps() {
return elementByClass(swalClasses.progresssteps);
};
Expand All @@ -275,6 +262,10 @@ var getCancelButton = function getCancelButton() {
return elementByClass(swalClasses.cancel);
};

var getButtonsWrapper = function getButtonsWrapper() {
return elementByClass(swalClasses.buttonswrapper);
};

var getCloseButton = function getCloseButton() {
return elementByClass(swalClasses.close);
};
Expand Down Expand Up @@ -1225,26 +1216,26 @@ var sweetAlert = function sweetAlert() {

var handleKeyDown = function handleKeyDown(event) {
var e = event || window.event;
var keyCode = e.keyCode || e.which;

if ([9, 13, 32, 27, 37, 38, 39, 40].indexOf(keyCode) === -1) {
// Don't do work on keys we don't care about.
return;
}
if (e.key === 'Enter') {
if (e.target === getInput()) {
sweetAlert.clickConfirm();
e.preventDefault();
}

var targetElement = e.target || e.srcElement;
// TAB
} else if (e.key === 'Tab') {
var targetElement = e.target || e.srcElement;

var focusableElements = getFocusableElements(params.focusCancel);
var btnIndex = -1; // Find the button - note, this is a nodelist, not an array.
for (var _i4 = 0; _i4 < focusableElements.length; _i4++) {
if (targetElement === focusableElements[_i4]) {
btnIndex = _i4;
break;
var focusableElements = getFocusableElements(params.focusCancel);
var btnIndex = -1; // Find the button - note, this is a nodelist, not an array.
for (var _i4 = 0; _i4 < focusableElements.length; _i4++) {
if (targetElement === focusableElements[_i4]) {
btnIndex = _i4;
break;
}
}
}

// TAB
if (keyCode === 9) {
if (!e.shiftKey) {
// Cycle to the next button
setFocus(btnIndex, 1);
Expand All @@ -1256,7 +1247,7 @@ var sweetAlert = function sweetAlert() {
e.preventDefault();

// ARROWS - switch focus between buttons
} else if (keyCode === 37 || keyCode === 38 || keyCode === 39 || keyCode === 40) {
} else if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'Arrowdown'].includes(e.key)) {
// focus Cancel button if Confirm button is currently focused
if (document.activeElement === confirmButton && isVisible(cancelButton)) {
cancelButton.focus();
Expand All @@ -1266,7 +1257,7 @@ var sweetAlert = function sweetAlert() {
}

// ESC
} else if (keyCode === 27 && params.allowEscapeKey === true) {
} else if (e.key === 'Escape' && params.allowEscapeKey === true) {
sweetAlert.closeModal(params.onClose);
if (params.useRejections) {
reject('esc');
Expand Down Expand Up @@ -1801,7 +1792,7 @@ sweetAlert.resetDefaults = function () {

sweetAlert.noop = function () {};

sweetAlert.version = '6.10.1';
sweetAlert.version = '6.10.2';

sweetAlert.default = sweetAlert;

Expand Down
4 changes: 4 additions & 0 deletions dist/sweetalert2.css
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ body.swal2-iosfix {
.swal2-modal .swal2-file:-ms-input-placeholder,
.swal2-modal .swal2-textarea:-ms-input-placeholder {
color: #cccccc; }
.swal2-modal .swal2-input::-ms-input-placeholder,
.swal2-modal .swal2-file::-ms-input-placeholder,
.swal2-modal .swal2-textarea::-ms-input-placeholder {
color: #cccccc; }
.swal2-modal .swal2-input::placeholder,
.swal2-modal .swal2-file::placeholder,
.swal2-modal .swal2-textarea::placeholder {
Expand Down
55 changes: 23 additions & 32 deletions dist/sweetalert2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* sweetalert2 v6.10.1
* sweetalert2 v6.10.2
* Released under the MIT License.
*/
(function (global, factory) {
Expand Down Expand Up @@ -186,15 +186,6 @@ var states = {
sweetAlert.resetValidationError();
};

input.onkeydown = function (event) {
setTimeout(function () {
if (event.keyCode === 13 && params.allowEnterKey) {
event.stopPropagation();
sweetAlert.clickConfirm();
}
}, 0);
};

file.onchange = function () {
sweetAlert.resetValidationError();
};
Expand Down Expand Up @@ -259,10 +250,6 @@ var getImage = function getImage() {
return elementByClass(swalClasses.image);
};

var getButtonsWrapper = function getButtonsWrapper() {
return elementByClass(swalClasses.buttonswrapper);
};

var getProgressSteps = function getProgressSteps() {
return elementByClass(swalClasses.progresssteps);
};
Expand All @@ -279,6 +266,10 @@ var getCancelButton = function getCancelButton() {
return elementByClass(swalClasses.cancel);
};

var getButtonsWrapper = function getButtonsWrapper() {
return elementByClass(swalClasses.buttonswrapper);
};

var getCloseButton = function getCloseButton() {
return elementByClass(swalClasses.close);
};
Expand Down Expand Up @@ -1229,26 +1220,26 @@ var sweetAlert = function sweetAlert() {

var handleKeyDown = function handleKeyDown(event) {
var e = event || window.event;
var keyCode = e.keyCode || e.which;

if ([9, 13, 32, 27, 37, 38, 39, 40].indexOf(keyCode) === -1) {
// Don't do work on keys we don't care about.
return;
}
if (e.key === 'Enter') {
if (e.target === getInput()) {
sweetAlert.clickConfirm();
e.preventDefault();
}

var targetElement = e.target || e.srcElement;
// TAB
} else if (e.key === 'Tab') {
var targetElement = e.target || e.srcElement;

var focusableElements = getFocusableElements(params.focusCancel);
var btnIndex = -1; // Find the button - note, this is a nodelist, not an array.
for (var _i4 = 0; _i4 < focusableElements.length; _i4++) {
if (targetElement === focusableElements[_i4]) {
btnIndex = _i4;
break;
var focusableElements = getFocusableElements(params.focusCancel);
var btnIndex = -1; // Find the button - note, this is a nodelist, not an array.
for (var _i4 = 0; _i4 < focusableElements.length; _i4++) {
if (targetElement === focusableElements[_i4]) {
btnIndex = _i4;
break;
}
}
}

// TAB
if (keyCode === 9) {
if (!e.shiftKey) {
// Cycle to the next button
setFocus(btnIndex, 1);
Expand All @@ -1260,7 +1251,7 @@ var sweetAlert = function sweetAlert() {
e.preventDefault();

// ARROWS - switch focus between buttons
} else if (keyCode === 37 || keyCode === 38 || keyCode === 39 || keyCode === 40) {
} else if (['ArrowLeft', 'ArrowRight', 'ArrowUp', 'Arrowdown'].includes(e.key)) {
// focus Cancel button if Confirm button is currently focused
if (document.activeElement === confirmButton && isVisible(cancelButton)) {
cancelButton.focus();
Expand All @@ -1270,7 +1261,7 @@ var sweetAlert = function sweetAlert() {
}

// ESC
} else if (keyCode === 27 && params.allowEscapeKey === true) {
} else if (e.key === 'Escape' && params.allowEscapeKey === true) {
sweetAlert.closeModal(params.onClose);
if (params.useRejections) {
reject('esc');
Expand Down Expand Up @@ -1805,7 +1796,7 @@ sweetAlert.resetDefaults = function () {

sweetAlert.noop = function () {};

sweetAlert.version = '6.10.1';
sweetAlert.version = '6.10.2';

sweetAlert.default = sweetAlert;

Expand Down

0 comments on commit 639955b

Please sign in to comment.