Skip to content

The open alternative to Salesforce, designed for AI.

Fix navigation skeleton overflow (#28663)

Raphaël Bosi4e1c213dc324
diff --git a/packages/twenty-front/src/loading/components/LeftPanelSkeletonLoader.tsx b/packages/twenty-front/src/loading/components/LeftPanelSkeletonLoader.tsx
index 17f3cb3ded7..130bc08550b 100644
--- a/packages/twenty-front/src/loading/components/LeftPanelSkeletonLoader.tsx
+++ b/packages/twenty-front/src/loading/components/LeftPanelSkeletonLoader.tsx
@@ -15,8 +15,8 @@ const StyledAnimatedContainer = styled(motion.div)`
flex-shrink: 0;
height: 100%;
overflow: hidden;
- padding: ${themeCssVariables.spacing[2]} 0 ${themeCssVariables.spacing[4]}
- ${themeCssVariables.spacing[2]};
+ padding: ${themeCssVariables.spacing[2]} ${themeCssVariables.spacing[2]}
+ ${themeCssVariables.spacing[4]} ${themeCssVariables.spacing[2]};
`;
const StyledItemsContainer = styled.div`
diff --git a/packages/twenty-front/src/loading/components/__stories__/LeftPanelSkeletonLoader.stories.tsx b/packages/twenty-front/src/loading/components/__stories__/LeftPanelSkeletonLoader.stories.tsx
new file mode 100644
index 00000000000..8a7fcf7e55a
--- /dev/null
+++ b/packages/twenty-front/src/loading/components/__stories__/LeftPanelSkeletonLoader.stories.tsx
@@ -0,0 +1,47 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { expect, within } from 'storybook/test';
+
+import { NAVIGATION_DRAWER_CONSTRAINTS } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerConstraints';
+import { LeftPanelSkeletonLoader } from '~/loading/components/LeftPanelSkeletonLoader';
+
+const meta: Meta<typeof LeftPanelSkeletonLoader> = {
+ title: 'App/Loading/LeftPanelSkeletonLoader',
+ component: LeftPanelSkeletonLoader,
+ parameters: {
+ layout: 'fullscreen',
+ },
+};
+
+export default meta;
+
+type Story = StoryObj<typeof LeftPanelSkeletonLoader>;
+
+export const Default: Story = {
+ render: () => (
+ <nav
+ aria-label="Loading navigation"
+ style={{ height: '100vh', width: NAVIGATION_DRAWER_CONSTRAINTS.default }}
+ >
+ <LeftPanelSkeletonLoader />
+ </nav>
+ ),
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const navigation = canvas.getByRole('navigation', {
+ name: 'Loading navigation',
+ });
+ const navigationBounds = navigation.getBoundingClientRect();
+ const skeletons = navigation.querySelectorAll('[data-skeleton]');
+
+ expect(skeletons.length).toBeGreaterThan(0);
+
+ for (const skeleton of skeletons) {
+ const skeletonBounds = skeleton.getBoundingClientRect();
+ const leftInset = skeletonBounds.left - navigationBounds.left;
+ const rightInset = navigationBounds.right - skeletonBounds.right;
+
+ expect(leftInset).toBeGreaterThan(0);
+ expect(rightInset).toBeGreaterThanOrEqual(leftInset);
+ }
+ },
+};