feat!: Friendlier typing for the ActiveState.aria property#111
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves the developer experience by simplifying the syntax for ARIA attributes in the ActiveState.aria property. Instead of requiring the full aria-* prefix (e.g., 'aria-selected'), developers can now use the unprefixed attribute name (e.g., selected).
- Introduced a new
ActiveStateAriaAttributestype that maps unprefixed ARIA attribute names to their values - Updated
activeBehaviorto prependaria-when setting/removing attributes - Updated
Link.svelteto transform unprefixed ARIA attributes to prefixed ones before applying them to the anchor element
Reviewed Changes
Copilot reviewed 5 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/lib/types.ts | Added ActiveStateAriaAttributes type and updated ActiveState.aria to use it |
| src/lib/behaviors/active.svelte.ts | Modified attribute handling to prepend aria- prefix when setting/removing attributes |
| src/lib/behaviors/active.svelte.test.ts | Updated test cases to use unprefixed ARIA attribute names |
| src/lib/Link/Link.svelte.test.ts | Updated test cases to use unprefixed ARIA attribute names |
| src/lib/Link/Link.svelte | Added calcActiveStateAria to transform unprefixed to prefixed ARIA attributes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #106.