Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 677
refactor(live-region): update live region helpers to match ADR#4673
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
234ceee247b1ac31901085030bcc81f56321de7745e48aa8280ba654e50c5629e6ad57813845cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@primer/react': minor | ||
| --- | ||
| Add experimental support for the AriaStatus, AriaAlert, and Announce components |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import {useCallback, useEffect, useRef} from 'react' | ||
| /** | ||
| * Create a callback that can be used within an effect without re-running the | ||
| * effect when the values used change. The callback passed to this hook will | ||
| * always see the latest snapshot of values that it uses and does not need to | ||
| * use a dependency array. | ||
| */ | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| export function useEffectCallback<T extends (...args: any) => any>(callback: T) { | ||
| const savedCallback = useRef<T>(callback) | ||
| useEffect(() => { | ||
| savedCallback.current = callback | ||
| }, [callback]) | ||
| return useCallback((...args: Parameters<T>): ReturnType<T> => { | ||
| return savedCallback.current(...args) | ||
| }, []) | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
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.
Stupid question, are there styles attached to
<Status>and is that different than<AriaStatus>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.
@jonrohan no styles, just behavior for now 👀 They're both setup as a
Boxthough internally 😅