3 ms·
In essence the modals are bound to the state of a checkbox. For this technique to work with escape The question thus becomes "Can you uncheck a checkbox with
by Lerc 10y ago
In essence the modals are bound to the state of a checkbox. For this technique to work with escape The question thus becomes "Can you uncheck a checkbox with escape, without JavaScript"
It's not a completely unreasonable thing to ask for.
Seems you can get close with the accesskey attribute
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/accesskey https://developer.mozilla.org/en-US/docs/Web/HTML/Global_att...
<input type="checkbox" accesskey="q">
It's not very standardized though, you need qualifiers and escape on its own doesn't seem to be available,
I don't know how it interacts with display:none .Ideally accesskey does not apply to display:none items so you could accesskey the same key for many modal close buttons and only have the visible one activate.