diff --git a/app/javascript/controllers/list_keyboard_navigation_controller.js b/app/javascript/controllers/list_keyboard_navigation_controller.js index 9a019e86..7e28069e 100644 --- a/app/javascript/controllers/list_keyboard_navigation_controller.js +++ b/app/javascript/controllers/list_keyboard_navigation_controller.js @@ -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) { diff --git a/app/views/accounts/new.html.erb b/app/views/accounts/new.html.erb index b8a2d4c1..9fe5f3fe 100644 --- a/app/views/accounts/new.html.erb +++ b/app/views/accounts/new.html.erb @@ -1,12 +1,12 @@

<%= t('.title')%>

<%= modal do %> -
+
<% if @account.accountable.blank? %>
<%= t '.select_accountable_type' %>
-
+
@@ -34,12 +34,12 @@
<% elsif params[:step] == 'method' && @account.accountable.present? %>
- <%= link_to new_account_path, class: "flex w-8 h-8 shrink-0 grow-0 items-center justify-center rounded-lg bg-[#141414]/5" do %> + <%= link_to new_account_path, class: "flex w-8 h-8 shrink-0 grow-0 items-center justify-center rounded-lg bg-[#141414]/5 back focus:outline-gray-300 focus:outline" do %> <%= lucide_icon('arrow-left', class: 'text-gray-500 w-5 h-5') %> <% end %> How would you like to add it?
-
+
@@ -62,7 +62,7 @@
<% else %>
- <%= link_to new_account_path(step: 'method', type: params[:type]), class: "flex w-8 h-8 shrink-0 grow-0 items-center justify-center rounded-lg bg-[#141414]/5" do %> + <%= link_to new_account_path(step: 'method', type: params[:type]), class: "flex w-8 h-8 shrink-0 grow-0 items-center justify-center rounded-lg bg-[#141414]/5 focus:outline-gray-300 focus:outline" do %> <%= lucide_icon('arrow-left', class: 'text-gray-500 w-5 h-5') %> <% end %> Add <%= @account.accountable.model_name.human.downcase %> @@ -72,7 +72,7 @@
<%= f.hidden_field :accountable_type %> - <%= f.text_field :name, placeholder: 'Example account name', required: 'required', label: 'Account name' %> + <%= f.text_field :name, placeholder: 'Example account name', required: 'required', label: 'Account name', autofocus: true %> <%= render "accounts/#{permitted_accountable_partial(@account.accountable_type)}", f: f %>