-
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.
chore(react-tabster): bump tabster to 8.5.0. (#33817)
- Loading branch information
Showing
9 changed files
with
67 additions
and
12 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-popover-c2932055-e9be-464a-ae9c-ac757e92fe96.json
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,7 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Update to satisfy the bumped Tabster 8.5.0.", | ||
"packageName": "@fluentui/react-popover", | ||
"email": "[email protected]", | ||
"dependentChangeType": "patch" | ||
} |
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-tabster-dac1f622-5b63-44b8-ab5a-a3e392cf8e8b.json
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,7 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "Nested modalizer fix and useActivateModal() hook to activate modals without moving focus.", | ||
"packageName": "@fluentui/react-tabster", | ||
"email": "[email protected]", | ||
"dependentChangeType": "minor" | ||
} |
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
28 changes: 28 additions & 0 deletions
28
packages/react-components/react-tabster/src/hooks/useActivateModal.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,28 @@ | ||
import * as React from 'react'; | ||
import { getModalizer } from 'tabster'; | ||
import { useTimeout } from '@fluentui/react-utilities'; | ||
import { useTabster } from './useTabster'; | ||
|
||
/** | ||
* Returns a function that activates a modal by element from the modal or modal container. | ||
*/ | ||
export function useActivateModal(): (elementFromModal: HTMLElement | undefined) => void { | ||
const tabster = useTabster(); | ||
const modalizerAPI = tabster ? getModalizer(tabster) : undefined; | ||
const [setActivateModalTimeout] = useTimeout(); | ||
|
||
const activateModal = React.useCallback( | ||
(elementFromModal: HTMLElement | undefined) => { | ||
// We call the actual activation function on the next tick, because with the typical use case, | ||
// the hook will be called on the same tick when other Tabster attributes are being applied, | ||
// and on the current tick the element has just received the attributes, but Tabster has not | ||
// instantiated the Modalizer yet. | ||
setActivateModalTimeout(() => { | ||
modalizerAPI?.activate(elementFromModal); | ||
}, 0); | ||
}, | ||
[modalizerAPI, setActivateModalTimeout], | ||
); | ||
|
||
return activateModal; | ||
} |
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