fix(blog): add missing back navigation and reuse BackButton across pages#2024
fix(blog): add missing back navigation and reuse BackButton across pages#2024epifaniofrancisco wants to merge 3 commits intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughAdds a new Vue 3 single-file component BackButton that uses useRouter() and useCanGoBack(), renders only when canGoBack is true, and calls router.back() on click. Replaces inline back-button markup and removes local useRouter/useCanGoBack calls across eight pages (about, accessibility, blog, compare, pds, privacy, recharging, settings). Adds accessibility test coverage for BackButton and normalises component path handling in a11y tests. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan for PR comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/components/BackButton.vue (1)
16-23: Remove inlinefocus-visibleutility; rely on global CSS.The project applies focus-visible styling for buttons globally via
main.css. The inlinefocus-visible:outline-accent/70class duplicates and potentially conflicts with the global rule.♻️ Suggested fix
<button v-if="canGoBack" type="button" :class="[ - 'inline-flex items-center gap-2 p-1.5 -mx-1.5 font-mono text-sm text-fg-muted hover:text-fg transition-colors duration-200 rounded focus-visible:outline-accent/70 shrink-0', + 'inline-flex items-center gap-2 p-1.5 -mx-1.5 font-mono text-sm text-fg-muted hover:text-fg transition-colors duration-200 rounded shrink-0', $props.class, ]" `@click`="router.back()" >Based on learnings: "In the npmx.dev project, focus-visible styling for buttons and selects is applied globally via main.css... individual buttons or selects in Vue components should not rely on inline focus-visible utility classes."
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 91e60ec1-f868-4cd9-9d32-ba1262534a48
📒 Files selected for processing (9)
app/components/BackButton.vueapp/pages/about.vueapp/pages/accessibility.vueapp/pages/blog/index.vueapp/pages/compare.vueapp/pages/pds.vueapp/pages/privacy.vueapp/pages/recharging.vueapp/pages/settings.vue
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: fe22398a-fc3d-44f3-b834-4cce13851bd3
📒 Files selected for processing (2)
test/nuxt/a11y.spec.tstest/unit/a11y-component-coverage.spec.ts
| describe('BackButton', () => { | ||
| it('should have no accessibility violations', async () => { | ||
| const component = await mountSuspended(BackButton) | ||
| const results = await runAxe(component) | ||
| expect(results.violations).toEqual([]) |
There was a problem hiding this comment.
Make this audit exercise the rendered button, not the empty v-if branch.
BackButton only renders when useCanGoBack() becomes truthy, and that composable starts as false until it sees a non-null router back state. Mounted as-is, this can pass against an empty container and still mark the component as covered. Seed a back entry or mock useCanGoBack() to true, then assert the <button> exists before running axe.
🔗 Linked issue
resolves #2022
🧭 Context
The Blog page didn’t include the same “back” navigation that exists on other informational pages (Privacy, Accessibility, Settings, etc.), causing inconsistent UX when navigating to
/blog.This PR fixes the Blog page and standardizes the back button implementation across the app.
📚 Description
<BackButton />component:app/pages/blog/index.vue) to include<BackButton /><BackButton />:app/pages/accessibility.vueapp/pages/compare.vueapp/pages/pds.vueapp/pages/privacy.vueapp/pages/recharging.vueapp/pages/settings.vue