-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: future Select and FilterSelect page jump on focus issue (#5123)
* update overlay and listbox components so focus is manually set * update future select portal story * Add useIsClientReady hook * update FilterSelect tests to increase functional coverage * add a fallback focus and clean up code comments
- Loading branch information
1 parent
6da428b
commit cdabe86
Showing
10 changed files
with
219 additions
and
30 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@kaizen/components": patch | ||
--- | ||
|
||
Fix for the tab focus jump issue on future Select and FilterSelect |
This file contains 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 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 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 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 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 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 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
1 change: 1 addition & 0 deletions
1
packages/components/src/__utilities__/useIsClientReady/index.ts
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./useIsClientReady" |
17 changes: 17 additions & 0 deletions
17
packages/components/src/__utilities__/useIsClientReady/useIsClientReady.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { useState, useEffect } from "react" | ||
|
||
/** | ||
* A hook that returns a truthy value indicating if the code can be run on client side. | ||
* This is a useful hook for determining if the `document` or `window` objects are available. | ||
*/ | ||
export const useIsClientReady = (): boolean => { | ||
const [isClientReady, setIsClientReady] = useState(false) | ||
|
||
useEffect(() => { | ||
if (typeof window !== "undefined" && typeof document !== "undefined") { | ||
setIsClientReady(true) | ||
} | ||
}, []) | ||
|
||
return isClientReady | ||
} |