fix action sheet

This commit is contained in:
Luke Pulverenti 2016-01-28 16:08:09 -05:00
parent 832ce4f3a0
commit 9589491df3
2 changed files with 24 additions and 26 deletions

View File

@ -58,7 +58,7 @@
var isScrollable = !browserInfo.safari; var isScrollable = !browserInfo.safari;
if (isScrollable) { if (isScrollable) {
html += '<paper-dialog-scrollable>'; //html += '<paper-dialog-scrollable>';
} }
var itemsWithIcons = options.items.filter(function (o) { var itemsWithIcons = options.items.filter(function (o) {
@ -96,7 +96,7 @@
html += '</paper-menu>'; html += '</paper-menu>';
if (isScrollable) { if (isScrollable) {
html += '</paper-dialog-scrollable>'; //html += '</paper-dialog-scrollable>';
} }
if (options.showCancel) { if (options.showCancel) {
@ -107,6 +107,8 @@
var dlg = document.createElement('paper-dialog'); var dlg = document.createElement('paper-dialog');
dlg.setAttribute('with-backdrop', 'with-backdrop'); dlg.setAttribute('with-backdrop', 'with-backdrop');
dlg.setAttribute('role', 'alertdialog');
dlg.setAttribute('noAutoFocus', 'noAutoFocus');
dlg.innerHTML = html; dlg.innerHTML = html;
if (pos) { if (pos) {
@ -114,29 +116,25 @@
dlg.style.left = pos.left + 'px'; dlg.style.left = pos.left + 'px';
dlg.style.top = pos.top + 'px'; dlg.style.top = pos.top + 'px';
} }
document.body.appendChild(dlg); document.body.appendChild(dlg);
// The animations flicker in IE dlg.animationConfig = {
if (!browserInfo.msie) { // scale up
dlg.animationConfig = { 'entry': {
// scale up name: 'scale-up-animation',
'entry': { node: dlg,
name: 'scale-up-animation', timing: { duration: 160, easing: 'ease-out' }
node: dlg, },
timing: { duration: 160, easing: 'ease-out' } // fade out
}, 'exit': {
// fade out name: 'fade-out-animation',
'exit': { node: dlg,
name: 'fade-out-animation', timing: { duration: 200, easing: 'ease-in' }
node: dlg, }
timing: { duration: 200, easing: 'ease-in' } };
}
};
}
setTimeout(function () { dlg.open();
dlg.open();
}, 50);
// Has to be assigned a z-index after the call to .open() // Has to be assigned a z-index after the call to .open()
dlg.addEventListener('iron-overlay-closed', function () { dlg.addEventListener('iron-overlay-closed', function () {
@ -146,9 +144,9 @@
// Seeing an issue in some non-chrome browsers where this is requiring a double click // Seeing an issue in some non-chrome browsers where this is requiring a double click
var eventName = browserInfo.chrome || browserInfo.safari ? 'click' : 'mousedown'; var eventName = browserInfo.chrome || browserInfo.safari ? 'click' : 'mousedown';
$('.actionSheetMenuItem', dlg).on(eventName, function () { dlg.querySelector('.actionSheetMenuItem').addEventListener(eventName, function (e) {
var selectedId = this.getAttribute('data-id'); var selectedId = e.target.getAttribute('data-id');
// Add a delay here to allow the click animation to finish, for nice effect // Add a delay here to allow the click animation to finish, for nice effect
setTimeout(function () { setTimeout(function () {

View File

@ -994,11 +994,11 @@
selectionCommandsPanel.innerHTML = html; selectionCommandsPanel.innerHTML = html;
$('.btnCloseSelectionPanel', selectionCommandsPanel).on('click', hideSelections); selectionCommandsPanel.querySelector('.btnCloseSelectionPanel').addEventListener('click', hideSelections);
var btnSelectionPanelOptions = selectionCommandsPanel.querySelector('.btnSelectionPanelOptions'); var btnSelectionPanelOptions = selectionCommandsPanel.querySelector('.btnSelectionPanelOptions');
$(btnSelectionPanelOptions).on('click', showMenuForSelectedItems); btnSelectionPanelOptions.addEventListener('click', showMenuForSelectedItems);
if (!browserInfo.mobile) { if (!browserInfo.mobile) {
shake(btnSelectionPanelOptions, 1); shake(btnSelectionPanelOptions, 1);