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;
if (isScrollable) {
html += '<paper-dialog-scrollable>';
//html += '<paper-dialog-scrollable>';
}
var itemsWithIcons = options.items.filter(function (o) {
@ -96,7 +96,7 @@
html += '</paper-menu>';
if (isScrollable) {
html += '</paper-dialog-scrollable>';
//html += '</paper-dialog-scrollable>';
}
if (options.showCancel) {
@ -107,6 +107,8 @@
var dlg = document.createElement('paper-dialog');
dlg.setAttribute('with-backdrop', 'with-backdrop');
dlg.setAttribute('role', 'alertdialog');
dlg.setAttribute('noAutoFocus', 'noAutoFocus');
dlg.innerHTML = html;
if (pos) {
@ -114,29 +116,25 @@
dlg.style.left = pos.left + 'px';
dlg.style.top = pos.top + 'px';
}
document.body.appendChild(dlg);
// The animations flicker in IE
if (!browserInfo.msie) {
dlg.animationConfig = {
// scale up
'entry': {
name: 'scale-up-animation',
node: dlg,
timing: { duration: 160, easing: 'ease-out' }
},
// fade out
'exit': {
name: 'fade-out-animation',
node: dlg,
timing: { duration: 200, easing: 'ease-in' }
}
};
}
dlg.animationConfig = {
// scale up
'entry': {
name: 'scale-up-animation',
node: dlg,
timing: { duration: 160, easing: 'ease-out' }
},
// fade out
'exit': {
name: 'fade-out-animation',
node: dlg,
timing: { duration: 200, easing: 'ease-in' }
}
};
setTimeout(function () {
dlg.open();
}, 50);
dlg.open();
// Has to be assigned a z-index after the call to .open()
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
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
setTimeout(function () {

View File

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