Materialize: Datepicker in a modal causes an infinite loop (1.0.0-beta)

Created on 27 Mar 2018  路  1Comment  路  Source: Dogfalo/materialize

Expected Behavior


If I create a modal and put a datepicker (or a timepicker) in it I expect it to work without freezing up my entire browser

Current Behavior


Currently if you open a modal and put a datepicker (or timepicker) in it that has it's container set to "body" (to prevent sizing issues) it will cause an infinite loop which eventually freezes up the browser

Possible Solution



We noticed that reverting to Alpha 4 fixed the issue, which leads me to suspect that the bug was introduced in commit https://github.com/Dogfalo/materialize/commit/da3f14834af2a35009e0cbd6b6f4a7dab3eb73c3
specifically the part where in the focus handler it calls focus again.

Steps to Reproduce (for bugs)

I created a codepen here (do note that attempting to open the datepicker twice sometimes causes the entire tab to freeze up)

Most helpful comment

Very nasty bug. Thanks a bunch for pointing this out. I now keep track of the order of modals opened, so only the last opened modal will trap focus preventing loops.

Fixed in 3ea4667a.

>All comments

Very nasty bug. Thanks a bunch for pointing this out. I now keep track of the order of modals opened, so only the last opened modal will trap focus preventing loops.

Fixed in 3ea4667a.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lpgeiger picture lpgeiger  路  3Comments

ReiiYuki picture ReiiYuki  路  3Comments

djensen47 picture djensen47  路  3Comments

PhillippOhlandt picture PhillippOhlandt  路  3Comments

heshamelmasry77 picture heshamelmasry77  路  3Comments