1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-23 07:09:39 +02:00

Improve account modal keyboard navigation (#424)

* Add back button support to account keyboard navigation and autofocus text input on the form

* Wrap modal content with keyboard navigation controller
This commit is contained in:
Sergey Tyan 2024-02-12 03:17:03 +08:00 committed by GitHub
parent fbe49bf4ea
commit e79ff94f6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View file

@ -17,7 +17,10 @@ export default class extends Controller {
getLinkTargetInDirection(direction) {
const indexOfLastFocus = this.indexOfLastFocus()
return this.focusableLinks[indexOfLastFocus + direction]
let nextIndex = (indexOfLastFocus + direction) % this.focusableLinks.length
if (nextIndex < 0) nextIndex = this.focusableLinks.length - 1
return this.focusableLinks[nextIndex]
}
indexOfLastFocus(targets = this.focusableLinks) {