From be0abeb53d3ef89eb63451cce6126a7ba21f631a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rebecca=20Ko=CC=88nig?= Date: Tue, 7 Jan 2025 09:53:09 +0100 Subject: [PATCH 1/2] =?UTF-8?q?fix(menu):=20don=E2=80=99t=20focus=20menu?= =?UTF-8?q?=20if=20menu=20has=20just=20been=20removed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/components/menu/src/Menu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/menu/src/Menu.tsx b/packages/components/menu/src/Menu.tsx index 1e0d97e189..8461360d3b 100644 --- a/packages/components/menu/src/Menu.tsx +++ b/packages/components/menu/src/Menu.tsx @@ -103,7 +103,7 @@ export function Menu(props: MenuProps) { }, 0); } else { setTimeout(() => { - menuListRef.current.focus({ preventScroll: false }); + menuListRef.current?.focus({ preventScroll: false }); }, 0); } } From 3be4b76545ba1d7dbd16d7aa14a14257642a796d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rebecca=20Ko=CC=88nig?= Date: Tue, 7 Jan 2025 10:00:46 +0100 Subject: [PATCH 2/2] chore: add changeset --- .changeset/seven-mails-kiss.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/seven-mails-kiss.md diff --git a/.changeset/seven-mails-kiss.md b/.changeset/seven-mails-kiss.md new file mode 100644 index 0000000000..f900207e80 --- /dev/null +++ b/.changeset/seven-mails-kiss.md @@ -0,0 +1,5 @@ +--- +'@contentful/f36-menu': patch +--- + +Don’t focus menu if menu has just been removed