-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
fix: enable tab on IOU request start page #45982
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
aaa9544
fix: only add active tab as focus trap container
dominictb 12dd780
Merge remote-tracking branch 'origin/main' into fix/43719-shift-tab-test
dominictb 5ae3af8
fix: lint, typescript and prettier
dominictb d952e41
Merge remote-tracking branch 'origin/main' into fix/43719-shift-tab-test
dominictb dc19b2c
fix: clean up implementation
dominictb f2825fa
fix: add some comment for new focus trap hook
dominictb cfeed3b
chore: enhance focus trap for onxy tab component
dominictb eaa1fe2
fix: typescript issue
dominictb d19ddbd
chore: clean up implementation
dominictb 48fd683
fix: add button role to tab selector item
dominictb fa5115a
chore: clean up implementation
dominictb 61718f8
chore: update code comments
dominictb 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
8 changes: 8 additions & 0 deletions
8
src/components/FocusTrap/FocusTrapContainerElement/FocusTrapContainerElementProps.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,8 @@ | ||
import type {ViewProps} from 'react-native'; | ||
|
||
type FocusTrapContainerElementProps = ViewProps & { | ||
/** Callback to register focus trap container element */ | ||
onContainerElementChanged?: (element: HTMLElement | null) => void; | ||
}; | ||
|
||
export default FocusTrapContainerElementProps; |
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,9 @@ | ||
import type FocusTrapContainerElementProps from './FocusTrapContainerElementProps'; | ||
|
||
function FocusTrapContainerElement({children}: FocusTrapContainerElementProps) { | ||
return children; | ||
} | ||
|
||
FocusTrapContainerElement.displayName = 'FocusTrapContainerElement'; | ||
|
||
export default FocusTrapContainerElement; |
32 changes: 32 additions & 0 deletions
32
src/components/FocusTrap/FocusTrapContainerElement/index.web.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,32 @@ | ||
/** | ||
* A wrapper View component allowing us to register a container element for a FocusTrap | ||
*/ | ||
import type {ForwardedRef} from 'react'; | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import type FocusTrapContainerElementProps from './FocusTrapContainerElementProps'; | ||
|
||
function FocusTrapContainerElement({onContainerElementChanged, ...props}: FocusTrapContainerElementProps, ref?: ForwardedRef<View>) { | ||
return ( | ||
<View | ||
ref={(node) => { | ||
const r = ref; | ||
if (typeof r === 'function') { | ||
r(node); | ||
} else if (r) { | ||
r.current = node; | ||
} | ||
if (node) { | ||
onContainerElementChanged?.(node as unknown as HTMLElement); | ||
return () => onContainerElementChanged?.(null); | ||
} | ||
}} | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...props} | ||
/> | ||
); | ||
} | ||
|
||
FocusTrapContainerElement.displayName = 'FocusTrapContainerElement'; | ||
|
||
export default React.forwardRef(FocusTrapContainerElement); |
5 changes: 5 additions & 0 deletions
5
src/components/FocusTrap/FocusTrapForScreen/FocusTrapProps.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 |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import type FocusTrap from 'focus-trap-react'; | ||
|
||
type FocusTrapForScreenProps = { | ||
children: React.ReactNode; | ||
|
||
/** Overrides the focus trap settings */ | ||
focusTrapSettings?: Pick<FocusTrap.Props, 'containerElements' | 'focusTrapOptions' | 'active'>; | ||
}; | ||
|
||
export default FocusTrapForScreenProps; |
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
Oops, something went wrong.
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.
Can
ref
be referenced directly? If so, please remove this unnecessary variable.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.
Since we have
ref.current = node
, we'll need to assign to a local variable to avoid eslint error