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:
parent
fbe49bf4ea
commit
e79ff94f6c
2 changed files with 10 additions and 7 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue