Steps to reproduce:
- open a dialoag via
setAttribute('opened', '')
- close the dialog via clicking outside or pressing esc
Expected:
Dialog no longer has the attribute opened set
Actual:
Dialog still has opened set in the DOM so code is required to remove then re-add the attribute
Example:
https://jsbin.com/xuxavaq/edit?html,output
In the example the code will set opened, if it is already set then it will fire an alert and remove the attribute from the DOM. I was having layout issues, but the backdrop was still showing when the dialog was open. You can test by clicking the button then pressing esc or clicking on the backdrop, then press the button again and the alert will get fired instead of immediately opening the dialog as you would expect.