-
Notifications
You must be signed in to change notification settings - Fork 26
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 #2669 from cozy/fix/593
Fix: Focus of fields when installing a konnector
- Loading branch information
Showing
6 changed files
with
180 additions
and
148 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React, { createContext, useState, useContext } from 'react' | ||
|
||
const DisableEnforceFocusModalContext = createContext(false) | ||
|
||
export const DisableEnforceFocusModalProvider = ({ children }) => { | ||
const [disableEnforceFocus, setDisableEnforceFocus] = useState(false) | ||
return ( | ||
<DisableEnforceFocusModalContext.Provider | ||
value={{ disableEnforceFocus, setDisableEnforceFocus }} | ||
> | ||
{children} | ||
</DisableEnforceFocusModalContext.Provider> | ||
) | ||
} | ||
|
||
export const useDisableEnforceFocusModal = () => { | ||
const disableEnforceFocusModalContext = useContext( | ||
DisableEnforceFocusModalContext | ||
) | ||
if (!disableEnforceFocusModalContext) { | ||
throw new Error( | ||
'useDisableEnforceFocusModal must be used within a EnforceFocusModalProvider' | ||
) | ||
} | ||
return disableEnforceFocusModalContext | ||
} |
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.