James Edwards on Nostr: I recently learned of an issue on the iPhone (but not iPad) when using FKA -- if you ...
I recently learned of an issue on the iPhone (but not iPad) when using FKA -- if you tab from an `<input>` to a `<select>`, the menu opens automatically, but when you choose an option or ESC to close it, focus is reset to the top of the page, thereby creating a keyboard trap.
Here's the fix:
```
document.addEventListener('blur', (e) => {
if(e.relatedTarget === null) {
e.target.focus();
}
}, true);
```
#javascript #ios #iphone #fka
Published at
2024-06-11 11:37:10Event JSON
{
"id": "de94bbdf2f6aea2b9ed0aed65811c7e335e7a5dc469d2590014f001f59f1aebb",
"pubkey": "5d78a900466c87ad276db31284220f3ac3611f9d40d4e0f9adabe87673b35e0a",
"created_at": 1718105830,
"kind": 1,
"tags": [
[
"t",
"javascript"
],
[
"t",
"iOS"
],
[
"t",
"iphone"
],
[
"t",
"fka"
],
[
"proxy",
"https://mastodon.world/users/siblingpastry/statuses/112597783735194904",
"activitypub"
]
],
"content": "I recently learned of an issue on the iPhone (but not iPad) when using FKA -- if you tab from an `\u003cinput\u003e` to a `\u003cselect\u003e`, the menu opens automatically, but when you choose an option or ESC to close it, focus is reset to the top of the page, thereby creating a keyboard trap. \n\nHere's the fix:\n\n```\ndocument.addEventListener('blur', (e) =\u003e {\n if(e.relatedTarget === null) {\n e.target.focus();\n }\n}, true);\n```\n\n#javascript #ios #iphone #fka",
"sig": "32edc64025fe838589460e4f9ee768aa6b79de0dd5132b913f07719e245afa50d612a4b0aa8fe805ffa0880d6dbe87e095a4833639967b0ea64eea5a881ff506"
}