From 9aa44dd335690f40990ca60257af6b265047fa26 Mon Sep 17 00:00:00 2001 From: Marcos Moura Date: Thu, 27 Oct 2022 15:29:19 +0200 Subject: [PATCH 1/2] fix(react-tabster): make acceptCondition optional as Tabster dont require it --- .../react-components/react-tabster/etc/react-tabster.api.md | 2 +- .../react-components/react-tabster/src/hooks/useFocusFinders.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-components/react-tabster/etc/react-tabster.api.md b/packages/react-components/react-tabster/etc/react-tabster.api.md index 4040a29519bd5..6cd1a8a36a220 100644 --- a/packages/react-components/react-tabster/etc/react-tabster.api.md +++ b/packages/react-components/react-tabster/etc/react-tabster.api.md @@ -64,7 +64,7 @@ export interface UseFocusableGroupOptions { // @public export const useFocusFinders: () => { - findAllFocusable: (container: HTMLElement, acceptCondition: (el: HTMLElement) => boolean) => HTMLElement[]; + findAllFocusable: (container: HTMLElement, acceptCondition?: ((el: HTMLElement) => boolean) | undefined) => HTMLElement[]; findFirstFocusable: (container: HTMLElement) => HTMLElement | null | undefined; findLastFocusable: (container: HTMLElement) => HTMLElement | null | undefined; findNextFocusable: (currentElement: HTMLElement, options?: Pick) => HTMLElement | null | undefined; diff --git a/packages/react-components/react-tabster/src/hooks/useFocusFinders.ts b/packages/react-components/react-tabster/src/hooks/useFocusFinders.ts index 4f89d7f6a289b..63763cc7039ed 100644 --- a/packages/react-components/react-tabster/src/hooks/useFocusFinders.ts +++ b/packages/react-components/react-tabster/src/hooks/useFocusFinders.ts @@ -10,7 +10,7 @@ export const useFocusFinders = () => { // Narrow props for now and let need dictate additional props in the future const findAllFocusable = React.useCallback( - (container: HTMLElement, acceptCondition: (el: HTMLElement) => boolean) => + (container: HTMLElement, acceptCondition?: (el: HTMLElement) => boolean) => tabster?.focusable.findAll({ container, acceptCondition }) || [], [tabster], ); From f8cfad8e40eaa4a8381e315145f618d610593e2f Mon Sep 17 00:00:00 2001 From: Marcos Moura Date: Thu, 27 Oct 2022 15:33:15 +0200 Subject: [PATCH 2/2] fix(react-tabster): add missing change file --- ...react-tabster-59ed64de-6eec-46c5-b0d6-2cd22cba4d0c.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@fluentui-react-tabster-59ed64de-6eec-46c5-b0d6-2cd22cba4d0c.json diff --git a/change/@fluentui-react-tabster-59ed64de-6eec-46c5-b0d6-2cd22cba4d0c.json b/change/@fluentui-react-tabster-59ed64de-6eec-46c5-b0d6-2cd22cba4d0c.json new file mode 100644 index 0000000000000..98b1703843bd4 --- /dev/null +++ b/change/@fluentui-react-tabster-59ed64de-6eec-46c5-b0d6-2cd22cba4d0c.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "make allowCondition a optional parameter for findAllFocusable function", + "packageName": "@fluentui/react-tabster", + "email": "marcosvmmoura@gmail.com", + "dependentChangeType": "patch" +}