From 25abc751879b2f7adddc47cbfb3930d256d93cef Mon Sep 17 00:00:00 2001 From: Joan Perals Tresserra Date: Tue, 12 Nov 2024 10:21:07 +0100 Subject: [PATCH] fix: Prevent scrollbar from overlapping side navigation content --- .../navigation-with-scrollbar.page.tsx | 55 ++++++++++++++++ src/__integ__/use-browser-with-scrollbars.ts | 66 +++++++++++++++++++ src/app-layout/__integ__/navigation.test.ts | 34 ++++++++++ .../navigation/index.tsx | 34 +++++----- .../navigation/styles.scss | 24 +++---- 5 files changed, 183 insertions(+), 30 deletions(-) create mode 100644 pages/app-layout/navigation-with-scrollbar.page.tsx create mode 100644 src/__integ__/use-browser-with-scrollbars.ts create mode 100644 src/app-layout/__integ__/navigation.test.ts diff --git a/pages/app-layout/navigation-with-scrollbar.page.tsx b/pages/app-layout/navigation-with-scrollbar.page.tsx new file mode 100644 index 0000000000..19d74ee74f --- /dev/null +++ b/pages/app-layout/navigation-with-scrollbar.page.tsx @@ -0,0 +1,55 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +import React from 'react'; + +import AppLayout from '~components/app-layout'; +import Select from '~components/select'; +import SideNavigation, { SideNavigationProps } from '~components/side-navigation'; + +import labels from './utils/labels'; + +const items: SideNavigationProps.Item[] = new Array(50).fill(null).map((_, index) => ({ + type: 'link', + text: `Link to page ${index + 1} with long enough text to wrap`, + href: '#', +})); + +const itemsControl = ( +