GoogleChrome / dialog-polyfill

Polyfill for the HTML dialog element
BSD 3-Clause "New" or "Revised" License
2.45k stars 245 forks source link

Scroll lock #112

Closed Danbardo closed 8 years ago

Danbardo commented 8 years ago

This is a hard bug to reproduce, but, sometimes after closing a dialog my scroll will remain locked until I refresh the page.

Is there a way to disable the scroll lock feature?

catwithlover commented 8 years ago

I use the code below to prevent this issue, this method is referred to this issue.

var dialog = document.querySelector('dialog');

/* ... */

//add a event-handler to refresh layout after close event on dialog
dialog.addEventListener('close', refreshLayout);

function refreshLayout() {
    document.querySelector('body').style.overflowY = '';
    document.querySelector('body').style.overflowY = 'auto';
}
samthor commented 8 years ago

I think this is a MDL issue, not a dialog issue.