Skip to content

Conversation

@webJose
Copy link
Contributor

@webJose webJose commented Oct 1, 2025

This alleviates the fact that the <Link> component lost the ability to set aria-current=page by default.

Now the <LinkContext> component can be used to specify CSS classes, CSS styles or aria attributes, meaning that creating navbars is now easier.

The unit testing for this component was very badly done, so it got re-worked, and revealed serious problems with the logic. All this has been corrected and is now covered by unit testing.

@webJose webJose requested a review from Copilot October 1, 2025 05:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the activeState property to the LinkContext component, allowing links within the context to automatically apply CSS classes, styles, or aria attributes when they become active. This feature complements the existing Link component's active state functionality and makes creating navigation components easier.

Key changes:

  • Added activeState property to LinkContext with CSS classes, styles, and aria attributes
  • Refactored Link component to separate activeFor and activeState properties
  • Completely rewrote LinkContext tests with better test utilities and coverage

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/lib/LinkContext/LinkContext.svelte Added activeState property support with proper inheritance and reactivity
src/lib/Link/Link.svelte Split activeState into activeFor and activeState, added context integration
src/lib/types.ts Removed key property from ActiveState type
src/testing/*.svelte Added new test utilities and removed old test components
src/lib/LinkContext/LinkContext.svelte.test.ts Complete rewrite with better test coverage
src/lib/Link/Link.svelte.test.ts Added LinkContext integration tests
src/testing/test-utils.ts Minor fix for library location mocking

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@webJose webJose merged commit a5f112f into main Oct 1, 2025
1 check passed
@webJose webJose deleted the JP/LinkContext branch October 1, 2025 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants