-
Notifications
You must be signed in to change notification settings - Fork 23
Enhancement/rename menu #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b9b92e4
a17d403
90274ea
3aaa161
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,7 +5,7 @@ | |||||
| {{- range $input.menu }} | ||||||
| <li> | ||||||
| <a class="footer-menu__link" href="{{ .URL }}" aria-label="{{- or (T (printf "menu.%s" .Identifier)) .Name }}"> | ||||||
| {{- or (T (printf "menu.%s" .Identifier)) .Name }} | ||||||
| {{- or .Name (T (printf "menu.%s" .Identifier)) }} | ||||||
|
||||||
| {{- or .Name (T (printf "menu.%s" .Identifier)) }} | |
| {{- or (T (printf "menu.%s" .Identifier)) .Name }} |
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link text now prefers .Name, but aria-label still prefers the translation. This can produce a mismatch between visible text and the accessible name. Make aria-label follow the same precedence as the rendered label (or derive it from the same $title variable).
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -24,7 +24,7 @@ | |||||||||||||||||||||
| {{- else }} | ||||||||||||||||||||||
| class="header-menu__link" | ||||||||||||||||||||||
| {{- end }}> | ||||||||||||||||||||||
| {{- or (T (printf "menu.%s" .Identifier)) .Name | safeHTML }} | ||||||||||||||||||||||
| {{- or .Name (T (printf "menu.%s" .Identifier)) | safeHTML }} | ||||||||||||||||||||||
|
||||||||||||||||||||||
| {{- or .Name (T (printf "menu.%s" .Identifier)) | safeHTML }} | |
| {{- $i18nKey := printf "menu.%s" .Identifier -}} | |
| {{- $i18nLabel := T $i18nKey -}} | |
| {{- if ne $i18nLabel $i18nKey -}} | |
| {{ $i18nLabel | safeHTML }} | |
| {{- else if .Name -}} | |
| {{ .Name | safeHTML }} | |
| {{- else -}} | |
| {{ .Identifier | safeHTML }} | |
| {{- end }} |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- $pageRef := .pageRef -}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- $translationKey := .translationKey -}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- range .menus }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- if eq .PageRef $pageRef }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{ if ne (lower .Name) .Identifier }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- or .Name (T $translationKey) }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{ else }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- or (T $translationKey) .Name }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{ end }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- break }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- end }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- end }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+3
to
+13
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| {{- range .menus }} | |
| {{- if eq .PageRef $pageRef }} | |
| {{ if ne (lower .Name) .Identifier }} | |
| {{- or .Name (T $translationKey) }} | |
| {{ else }} | |
| {{- or (T $translationKey) .Name }} | |
| {{ end }} | |
| {{- break }} | |
| {{- end }} | |
| {{- end }} | |
| {{- $label := T $translationKey -}} | |
| {{- range .menus }} | |
| {{- if eq .PageRef $pageRef }} | |
| {{- if ne (lower .Name) .Identifier }} | |
| {{- $label = or .Name (T $translationKey) -}} | |
| {{- else }} | |
| {{- $label = or (T $translationKey) .Name -}} | |
| {{- end }} | |
| {{- break }} | |
| {{- end }} | |
| {{- end }} | |
| {{- $label -}} |
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are Playwright tests for menu rendering (e.g. tests/secondary-menu.spec.ts), but this change introduces new behavior (name override vs translation, and headings derived from menu config) without coverage. Add/update tests to assert: (1) default menus still render translated labels, and (2) setting name in menu config overrides the translation for that entry.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |||||
| class="sidebar-menu__link" | ||||||
| {{- end }} | ||||||
| aria-label="{{- or (T (printf " menu.%s" .Identifier)) .Name }}"> | ||||||
|
||||||
| aria-label="{{- or (T (printf " menu.%s" .Identifier)) .Name }}"> | |
| aria-label="{{- or .Name (T (printf "menu.%s" .Identifier)) }}"> |
Copilot
AI
Feb 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like the header menu, this now prefers .Name over the menu.<identifier> translation. With automatically generated menus (e.g. sectionPagesMenu: main), .Name is populated from page/section titles even when the user didn’t explicitly set name, which can break localization. Consider using the translation by default and only using .Name as an override when explicitly configured / when it differs from the default identifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "presedence" should be "precedence" (and consider hyphenating "user-defined").