diff --git a/app/views/layouts/shared/_nav_item.html.erb b/app/views/layouts/shared/_nav_item.html.erb
index 7ab4888ba..3c700e184 100644
--- a/app/views/layouts/shared/_nav_item.html.erb
+++ b/app/views/layouts/shared/_nav_item.html.erb
@@ -1,6 +1,6 @@
<%# locals:(name:, path:, icon:, icon_custom:, active:, mobile_only: false) %>
-<%= link_to path, class: "space-y-1 group block relative pb-1" do %>
+<%= link_to path, class: "space-y-1 group block relative pb-1", aria: { current: ("page" if active) } do %>
<%= tag.div class: class_names("w-4 h-1 lg:w-1 lg:h-4 rounded-bl-sm rounded-br-sm lg:rounded-tr-sm lg:rounded-br-sm lg:rounded-bl-none", "bg-nav-indicator" => active) %>
diff --git a/config/locales/views/layout/ca.yml b/config/locales/views/layout/ca.yml
index 8868c451c..d2981ad51 100644
--- a/config/locales/views/layout/ca.yml
+++ b/config/locales/views/layout/ca.yml
@@ -3,6 +3,7 @@ ca:
layouts:
application:
privacy_mode: Alternar mode de privadesa
+ skip_to_main: Saltar al contingut principal
nav:
assistant: Assistent
budgets: Pressupostos
diff --git a/config/locales/views/layout/de.yml b/config/locales/views/layout/de.yml
index 3af54c26b..1aeb9ed1b 100644
--- a/config/locales/views/layout/de.yml
+++ b/config/locales/views/layout/de.yml
@@ -3,6 +3,7 @@ de:
layouts:
application:
privacy_mode: Datenschutzmodus umschalten
+ skip_to_main: Zum Hauptinhalt springen
nav:
assistant: Assistent
budgets: Budgets
diff --git a/config/locales/views/layout/en.yml b/config/locales/views/layout/en.yml
index 86ad78ace..52b0cf65d 100644
--- a/config/locales/views/layout/en.yml
+++ b/config/locales/views/layout/en.yml
@@ -3,6 +3,7 @@ en:
layouts:
application:
privacy_mode: Toggle privacy mode
+ skip_to_main: Skip to main content
nav:
assistant: Assistant
budgets: Budgets
diff --git a/config/locales/views/layout/es.yml b/config/locales/views/layout/es.yml
index b1627fd14..080d6e37a 100644
--- a/config/locales/views/layout/es.yml
+++ b/config/locales/views/layout/es.yml
@@ -3,6 +3,7 @@ es:
layouts:
application:
privacy_mode: Alternar modo de privacidad
+ skip_to_main: Saltar al contenido principal
nav:
assistant: Asistente
budgets: Presupuestos
diff --git a/config/locales/views/layout/fr.yml b/config/locales/views/layout/fr.yml
index 54f9cca4b..0cec20575 100644
--- a/config/locales/views/layout/fr.yml
+++ b/config/locales/views/layout/fr.yml
@@ -3,6 +3,7 @@ fr:
layouts:
application:
privacy_mode: Activer/désactiver le mode confidentialité
+ skip_to_main: Aller au contenu principal
nav:
assistant: Assistant
budgets: Budgets
diff --git a/config/locales/views/layout/hu.yml b/config/locales/views/layout/hu.yml
index f77a35f3c..7a0d252b4 100644
--- a/config/locales/views/layout/hu.yml
+++ b/config/locales/views/layout/hu.yml
@@ -3,6 +3,7 @@ hu:
layouts:
application:
privacy_mode: Adatvédelmi mód váltása
+ skip_to_main: Ugrás a fő tartalomhoz
nav:
assistant: Asszisztens
budgets: Költségvetések
diff --git a/config/locales/views/layout/nb.yml b/config/locales/views/layout/nb.yml
index ebabc16cf..be6aed666 100644
--- a/config/locales/views/layout/nb.yml
+++ b/config/locales/views/layout/nb.yml
@@ -3,6 +3,7 @@ nb:
layouts:
application:
privacy_mode: Veksle personvernmodus
+ skip_to_main: Hopp til hovedinnhold
nav:
assistant: Assistent
budgets: Budsjett
diff --git a/config/locales/views/layout/nl.yml b/config/locales/views/layout/nl.yml
index 9ee7a2b1b..322f87195 100644
--- a/config/locales/views/layout/nl.yml
+++ b/config/locales/views/layout/nl.yml
@@ -3,6 +3,7 @@ nl:
layouts:
application:
privacy_mode: Privacymodus in-/uitschakelen
+ skip_to_main: Ga naar hoofdinhoud
nav:
assistant: Assistent
budgets: Budgetten
diff --git a/config/locales/views/layout/pl.yml b/config/locales/views/layout/pl.yml
index fe70cadf6..1f68d3cf8 100644
--- a/config/locales/views/layout/pl.yml
+++ b/config/locales/views/layout/pl.yml
@@ -3,6 +3,7 @@ pl:
layouts:
application:
privacy_mode: Przełącz tryb prywatności
+ skip_to_main: Przejdź do głównej treści
nav:
assistant: Asystent
budgets: Budżety
diff --git a/config/locales/views/layout/pt-BR.yml b/config/locales/views/layout/pt-BR.yml
index 2f76fecca..61a25ddf2 100644
--- a/config/locales/views/layout/pt-BR.yml
+++ b/config/locales/views/layout/pt-BR.yml
@@ -3,6 +3,7 @@ pt-BR:
layouts:
application:
privacy_mode: Alternar modo de privacidade
+ skip_to_main: Pular para o conteúdo principal
nav:
assistant: Assistente
budgets: Orçamentos
diff --git a/config/locales/views/layout/ro.yml b/config/locales/views/layout/ro.yml
index 15ed02dac..218d33e36 100644
--- a/config/locales/views/layout/ro.yml
+++ b/config/locales/views/layout/ro.yml
@@ -3,6 +3,7 @@ ro:
layouts:
application:
privacy_mode: Comutare mod confidențialitate
+ skip_to_main: Sari la conținutul principal
nav:
assistant: Asistent
budgets: Bugete
diff --git a/config/locales/views/layout/tr.yml b/config/locales/views/layout/tr.yml
index d7a482e42..5a8ad2877 100644
--- a/config/locales/views/layout/tr.yml
+++ b/config/locales/views/layout/tr.yml
@@ -3,6 +3,7 @@ tr:
layouts:
application:
privacy_mode: Gizlilik modunu değiştir
+ skip_to_main: Ana içeriğe atla
nav:
assistant: Asistan
budgets: Bütçeler
diff --git a/config/locales/views/layout/zh-CN.yml b/config/locales/views/layout/zh-CN.yml
index 8fc58045e..0cd552d11 100644
--- a/config/locales/views/layout/zh-CN.yml
+++ b/config/locales/views/layout/zh-CN.yml
@@ -4,6 +4,7 @@ zh-CN:
layouts:
application:
privacy_mode: 切换隐私模式
+ skip_to_main: 跳到主要内容
nav:
assistant: 智能助手
budgets: 预算管理
diff --git a/config/locales/views/layout/zh-TW.yml b/config/locales/views/layout/zh-TW.yml
index 091625bea..597dd971c 100644
--- a/config/locales/views/layout/zh-TW.yml
+++ b/config/locales/views/layout/zh-TW.yml
@@ -3,6 +3,7 @@ zh-TW:
layouts:
application:
privacy_mode: 切換隱私模式
+ skip_to_main: 跳至主要內容
nav:
assistant: 助手
budgets: 預算
diff --git a/test/integration/layout_accessibility_test.rb b/test/integration/layout_accessibility_test.rb
new file mode 100644
index 000000000..5a232721f
--- /dev/null
+++ b/test/integration/layout_accessibility_test.rb
@@ -0,0 +1,27 @@
+require "test_helper"
+
+class LayoutAccessibilityTest < ActionDispatch::IntegrationTest
+ setup do
+ sign_in users(:family_admin)
+ end
+
+ test "application layout renders skip-link pointing at #main and a with id=\"main\"" do
+ get root_path
+ assert_response :ok
+
+ skip_text = I18n.t("layouts.application.skip_to_main")
+
+ assert_select "a[href=\"#main\"]", text: skip_text
+ assert_select "main#main"
+ end
+
+ test "settings layout renders skip-link pointing at #main and a with id=\"main\"" do
+ get settings_profile_path
+ assert_response :ok
+
+ skip_text = I18n.t("layouts.application.skip_to_main")
+
+ assert_select "a[href=\"#main\"]", text: skip_text
+ assert_select "main#main"
+ end
+end
diff --git a/test/views/layouts/shared/nav_item_view_test.rb b/test/views/layouts/shared/nav_item_view_test.rb
new file mode 100644
index 000000000..b03bcbf37
--- /dev/null
+++ b/test/views/layouts/shared/nav_item_view_test.rb
@@ -0,0 +1,27 @@
+require "test_helper"
+
+class NavItemViewTest < ActionView::TestCase
+ test "active nav item carries aria-current=\"page\"" do
+ html = render(partial: "layouts/shared/nav_item", locals: {
+ name: "Transactions",
+ path: "/transactions",
+ icon: "credit-card",
+ icon_custom: false,
+ active: true
+ })
+
+ assert_includes html, "aria-current=\"page\""
+ end
+
+ test "inactive nav item omits aria-current" do
+ html = render(partial: "layouts/shared/nav_item", locals: {
+ name: "Transactions",
+ path: "/transactions",
+ icon: "credit-card",
+ icon_custom: false,
+ active: false
+ })
+
+ assert_not_includes html, "aria-current"
+ end
+end