-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45982 from dominictb/fix/43719-shift-tab-test
fix: enable tab on IOU request start page
- Loading branch information
Showing
13 changed files
with
357 additions
and
119 deletions.
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; |
29 changes: 29 additions & 0 deletions
29
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,29 @@ | ||
/** | ||
* 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; | ||
} | ||
onContainerElementChanged?.(node as unknown as HTMLElement | 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.