mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-20 05:39:39 +02:00
New Add Account UI
* Add Lucide gem (#364) * feat: add cursor pointer in the log-in and create account pages, also make full with (it's cutted right now) the fileds in the settings edit page * feat: skip system test with an explanation instead of comment them * fix typo in the skip * feat: add lucide gem * Add reusable modal (#362) * Remove unused form * Add reusable modal * Prelim styling * Add instructions --------- Co-authored-by: Josh Pigford <josh@joshpigford.com> * Add keyboard navigation to new account selector (#375) * New account menu (#372) * New account menu * Styling tweaks --------- Signed-off-by: Josh Pigford <josh@joshpigford.com> * Entry method links (#376) * Initial add account form (#378) * Initial add account form * Unused --------- Signed-off-by: Josh Pigford <josh@joshpigford.com> Co-authored-by: Pedro López Mareque <Pedro.lopez.mareque@gmail.com> Co-authored-by: Rob Zolkos <rob@zolkos.com> Co-authored-by: Josh Brown <josh@joossh.com>
This commit is contained in:
parent
e79636f372
commit
4761619870
18 changed files with 208 additions and 57 deletions
|
@ -0,0 +1,36 @@
|
|||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
// Connects to data-controller="list-keyboard-navigation"
|
||||
export default class extends Controller {
|
||||
focusPrevious() {
|
||||
this.focusLinkTargetInDirection(-1)
|
||||
}
|
||||
|
||||
focusNext() {
|
||||
this.focusLinkTargetInDirection(1)
|
||||
}
|
||||
|
||||
focusLinkTargetInDirection(direction) {
|
||||
const element = this.getLinkTargetInDirection(direction)
|
||||
element?.focus()
|
||||
}
|
||||
|
||||
getLinkTargetInDirection(direction) {
|
||||
const indexOfLastFocus = this.indexOfLastFocus()
|
||||
return this.focusableLinks[indexOfLastFocus + direction]
|
||||
}
|
||||
|
||||
indexOfLastFocus(targets = this.focusableLinks) {
|
||||
const indexOfActiveElement = targets.indexOf(document.activeElement)
|
||||
|
||||
if (indexOfActiveElement !== -1) {
|
||||
return indexOfActiveElement
|
||||
} else {
|
||||
return targets.findIndex(target => target.getAttribute("tabindex") === "0")
|
||||
}
|
||||
}
|
||||
|
||||
get focusableLinks() {
|
||||
return Array.from(this.element.querySelectorAll("a[href]"))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue