mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00: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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user