-
Notifications
You must be signed in to change notification settings - Fork 12
chore: bump packages and convert test-app to strict template tag #412
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
Open
aklkv
wants to merge
4
commits into
ember-a11y:main
Choose a base branch
from
aklkv:chore/bump-packages
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5f0171f
chore: bump packages and convert test-app to strict template tag
aklkv 7cdb587
replace back ticks to make glint happy since stable version does like it
aklkv 04dd5ca
remove jsdoc and add comments that are actually helpful in code editors
aklkv beb7689
fix styles and bump `@embroider/addon-dev` & `babel-plugin-ember-temp…
aklkv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,7 @@ import { on } from '@ember/modifier'; | |
| import { registerDestructor } from '@ember/destroyable'; | ||
| import { schedule, cancel } from '@ember/runloop'; | ||
|
|
||
| import '../styles/navigation-narrator.css'; | ||
| import { defaultValidator } from '../utils/validators.js'; | ||
|
|
||
| import type RouterService from '@ember/routing/router-service'; | ||
|
|
@@ -14,21 +15,43 @@ import type { Timer } from '@ember/runloop'; | |
|
|
||
| export interface NavigationNarratorSignature { | ||
| Args: { | ||
| /** Whether to include the skip link. Defaults to `true`. */ | ||
| skipLink?: boolean; | ||
|
|
||
| /** CSS selector the skip link jumps to. Defaults to `'#main'`. */ | ||
| skipTo?: string; | ||
|
|
||
| /** Text content of the skip link. Defaults to `'Skip to main content'`. */ | ||
| skipText?: string; | ||
|
|
||
| /** Text announced by a screen reader after navigation. */ | ||
| navigationText?: string; | ||
|
|
||
| /** Custom logic for determining whether a transition should trigger narration. */ | ||
| routeChangeValidator?: (transition: Transition) => boolean; | ||
| excludeAllQueryParams?: boolean; | ||
| }; | ||
|
|
||
| Blocks: { | ||
| default: []; | ||
| /** Whether to ignore query param changes during route comparisons. Defaults to `false`. */ | ||
| excludeAllQueryParams?: boolean; | ||
| }; | ||
|
|
||
| Element: HTMLElement; | ||
| } | ||
|
|
||
| /** | ||
| * 🎧 NavigationNarrator | ||
| * | ||
| * Announces route changes for screen readers using a visually-hidden element, | ||
| * and optionally renders a "Skip to main content" link. | ||
| * | ||
| * Usage: | ||
| * ```gjs | ||
| * import { NavigationNarrator } from 'ember-a11y-refocus'; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it also turns out that we can not use |
||
| * | ||
| * <template> | ||
| * <NavigationNarrator /> | ||
| * </template> | ||
| * ``` | ||
| */ | ||
| export default class NavigationNarrator extends Component<NavigationNarratorSignature> { | ||
| @service declare readonly router: RouterService; | ||
|
|
||
|
|
@@ -37,74 +60,53 @@ export default class NavigationNarrator extends Component<NavigationNarratorSign | |
| timer: Timer | undefined; | ||
| transition: Transition | undefined; | ||
|
|
||
| /* | ||
| * @param skipLink | ||
| * @type {boolean} | ||
| * @description Whether or not to include the skip link in the page. If you don't want the skip link to be included, you can set this to false. | ||
| * @default true | ||
| */ | ||
| constructor(owner: Owner, args: NavigationNarratorSignature['Args']) { | ||
| super(owner, args); | ||
|
|
||
| this.router.on('routeDidChange', this.onRouteChange); | ||
|
|
||
| registerDestructor(this, () => { | ||
| // eslint-disable-next-line ember/no-runloop | ||
| cancel(this.timer); | ||
| this.timer = undefined; | ||
| this.router.off('routeDidChange', this.onRouteChange); | ||
| }); | ||
| } | ||
|
|
||
| /** Whether to include the skip link. Defaults to `true`. */ | ||
| get skipLink() { | ||
| return this.args.skipLink ?? true; | ||
| } | ||
|
|
||
| /* | ||
| * @param skipTo | ||
| * @type {string} | ||
| * @description Element selector for what the skip link should jump to. A default is provided but this can be customized. | ||
| * @default '#main' | ||
| */ | ||
| /** Selector for the skip link target. Defaults to `'#main'`. */ | ||
| get skipTo() { | ||
| return this.args.skipTo ?? '#main'; | ||
| } | ||
|
|
||
| /* | ||
| * @param skipText | ||
| * @type {string} | ||
| * @description text of the bypass block/skip link. Default text is provided but it can be customized. | ||
| * @default 'Skip to main content' | ||
| */ | ||
| /** Text for the skip link. Defaults to `'Skip to main content'`. */ | ||
| get skipText() { | ||
| return this.args.skipText ?? 'Skip to main content'; | ||
| } | ||
|
|
||
| /* | ||
| * @param navigationText | ||
| * @type {string} | ||
| * @description The text to be read by the screen reader when the page navigation is complete. While a default message is provided, it can be customized to better fit the needs of your application. | ||
| * @default 'The page navigation is complete. You may now navigate the page content as you wish.' | ||
| */ | ||
| /** Text announced by screen readers after route transition. */ | ||
| get navigationText() { | ||
| return ( | ||
| this.args.navigationText ?? | ||
| 'The page navigation is complete. You may now navigate the page content as you wish.' | ||
| ); | ||
| } | ||
|
|
||
| /* | ||
| * @param routeChangeValidator | ||
| * @type {function} | ||
| * @description A function that can be used to provide a custom definition of a route transition. Typically used if you have some query params that you don't want to trigger the route transition (but you would otherwise mostly want it to behave per Ember's default). | ||
| */ | ||
| /** Validator function for transitions. */ | ||
| get routeChangeValidator() { | ||
| return this.args.routeChangeValidator ?? defaultValidator; | ||
| } | ||
|
|
||
| /* | ||
| * @param excludeAllQueryParams | ||
| * @type {boolean} | ||
| * @description Whether or not to include all query params in definition of a route transition. If you want to include/exclude _some_ query params, the routeChangeValidator function should be used instead. | ||
| * @default false | ||
| */ | ||
| /** Whether to ignore query param changes. Defaults to `false`. */ | ||
| get excludeAllQueryParams() { | ||
| return this.args.excludeAllQueryParams ?? false; | ||
| } | ||
|
|
||
| /* | ||
| * @param hasQueryParams | ||
| * @type {boolean} | ||
| * @description Check for queryParams. | ||
| * @default false | ||
| */ | ||
| /** Whether the current transition includes query param changes. */ | ||
| get hasQueryParams() { | ||
| if ( | ||
| Object.keys(this.transition?.from?.queryParams || {}).length || | ||
|
|
@@ -116,19 +118,6 @@ export default class NavigationNarrator extends Component<NavigationNarratorSign | |
| } | ||
| } | ||
|
|
||
| constructor(owner: Owner, args: NavigationNarratorSignature['Args']) { | ||
| super(owner, args); | ||
|
|
||
| this.router.on('routeDidChange', this.onRouteChange); | ||
|
|
||
| registerDestructor(this, () => { | ||
| // eslint-disable-next-line ember/no-runloop | ||
| cancel(this.timer); | ||
| this.timer = undefined; | ||
| this.router.off('routeDidChange', this.onRouteChange); | ||
| }); | ||
| } | ||
|
|
||
| onRouteChange = (transition: Transition) => { | ||
| this.transition = transition; // We need to do this because we can't pass an argument to a getter | ||
|
|
||
|
|
||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,14 +19,15 @@ | |
| "test": "pnpm --filter '*' test" | ||
| }, | ||
| "devDependencies": { | ||
| "@glint/core": "^1.5.1", | ||
| "concurrently": "^9.1.2", | ||
| "prettier": "^3.4.2", | ||
| "prettier-plugin-ember-template-tag": "^2.0.4", | ||
| "release-plan": "^0.17.0" | ||
| "@glint/core": "^1.5.2", | ||
| "concurrently": "^9.2.1", | ||
| "prettier": "^3.6.2", | ||
| "prettier-plugin-ember-template-tag": "^2.1.0", | ||
| "release-plan": "^0.17.2" | ||
| }, | ||
| "packageManager": "[email protected]+sha512.fce8a3dd29a4ed2ec566fb53efbb04d8c44a0f05bc6f24a73046910fb9c3ce7afa35a0980500668fa3573345bd644644fa98338fa168235c80f4aa17aa17fbef", | ||
| "engines": { | ||
| "pnpm": ">= 10.0.0" | ||
| "node": "22.x", | ||
| "pnpm": ">= 10" | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
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.

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.
all this will show up like so in VS code at least
Screen.Recording.2025-06-15.at.6.36.51.PM.mov