From 58657e56bf04205e6f8440d424247122a27a5401 Mon Sep 17 00:00:00 2001 From: Cory Harper Date: Wed, 21 Apr 2021 17:57:51 -0500 Subject: [PATCH 1/4] altered compiler target --- tsconfig.build.json | 2 +- tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tsconfig.build.json b/tsconfig.build.json index 602f359..2e2c422 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -3,7 +3,7 @@ "compilerOptions": { "module": "CommonJS", "outDir": "./dist/", - "target": "ES2015" + "target": "es5" }, "exclude": ["**/*.test.ts", "**/*.test.tsx"] } diff --git a/tsconfig.json b/tsconfig.json index 7dd6aef..eaea978 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,6 @@ "extends": "./tsconfig.base.json", "compilerOptions": { "module": "CommonJS", - "target": "ES2015" + "target": "es5" } } From 13a6c5b6cc86f0b6319609b7088c9f0951078ba6 Mon Sep 17 00:00:00 2001 From: Cory Harper Date: Wed, 21 Apr 2021 17:57:51 -0500 Subject: [PATCH 2/4] Revert "altered compiler target" This reverts commit 58657e56bf04205e6f8440d424247122a27a5401. --- tsconfig.build.json | 2 +- tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tsconfig.build.json b/tsconfig.build.json index 2e2c422..602f359 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -3,7 +3,7 @@ "compilerOptions": { "module": "CommonJS", "outDir": "./dist/", - "target": "es5" + "target": "ES2015" }, "exclude": ["**/*.test.ts", "**/*.test.tsx"] } diff --git a/tsconfig.json b/tsconfig.json index eaea978..7dd6aef 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,6 +2,6 @@ "extends": "./tsconfig.base.json", "compilerOptions": { "module": "CommonJS", - "target": "es5" + "target": "ES2015" } } From 4192a3e0e997e85a2a6fcd5bcc7f8d84ccb3cf36 Mon Sep 17 00:00:00 2001 From: Cory Harper Date: Thu, 22 Apr 2021 15:30:00 -0500 Subject: [PATCH 3/4] refactored all spread array constructors to Array.from --- src/use-dropdown-menu.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/use-dropdown-menu.ts b/src/use-dropdown-menu.ts index 8126a90..4b22e9e 100644 --- a/src/use-dropdown-menu.ts +++ b/src/use-dropdown-menu.ts @@ -36,7 +36,7 @@ export default function useDropdownMenu(itemCount: number): DropdownMenuResponse // Initialize refs and update them when the item count changes useEffect(() => { - itemRefs.current = [...Array(itemCount)].map(() => createRef()); + itemRefs.current = Array.from({ length: itemCount }, () => createRef()); }, [itemCount]); // Create type guard @@ -199,7 +199,7 @@ export default function useDropdownMenu(itemCount: number): DropdownMenuResponse 'aria-expanded': isOpen, }; - const itemProps = [...Array(itemCount)].map((_ignore, index) => ({ + const itemProps = Array.from({ length: itemCount }, (_ignore, index) => ({ onKeyDown: itemListener, tabIndex: -1, role: 'menuitem', From 15bb24f920123bc1a800fe59e65971a8210605e9 Mon Sep 17 00:00:00 2001 From: Cory Harper Date: Thu, 22 Apr 2021 16:18:58 -0500 Subject: [PATCH 4/4] bumped patch version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 53a8d16..b743fdc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-accessible-dropdown-menu-hook", - "version": "2.2.0", + "version": "2.2.1", "description": "A simple Hook for creating fully accessible dropdown menus in React", "main": "dist/use-dropdown-menu.js", "types": "dist/use-dropdown-menu.d.ts",