Modal's Esc key functionality not working correctly
Created by: JackEllis
I wanted to make this into an issue rather than attempt to finish my PR (#15252), because I'm unsure on the correct way to write javascript unit tests for the stuff I'm correcting.
2 problems that happen when pressing the escape key when the modal is open
- The backdrop isn't removed (see https://github.com/twbs/bootstrap/blob/9a7e365c2c4360335d25246dac11afb1f577210a/js/modal.js#L184)
- The correct method isn't called (see https://github.com/twbs/bootstrap/blob/9a7e365c2c4360335d25246dac11afb1f577210a/js/modal.js#L144 and you'll see it calls hide() instead of hideModal()
I think it would be easier to just call removeBackdrop() from near line 1048 personally.