react-component / react-component/menu

Horizontal menu does not overflow if preceded by a floating block

Open
#200 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
701
Forks
266
Avg merge
4d 11h
Merged PRs (30d)
3

Description

I am recreating a layout similar to that of https://ant.design/components/layout/#components-layout-demo-top but placing a logo on the left of the menu apparently breaks the computation of the menu width and, hence, of the overflowed items.

error

import React from 'react';

import { Layout, Menu } from 'antd';

const { Header } = Layout;

function App(props) {
  return (
    <Layout>
      <Header>
        <div className="logo" />
        <Menu
          theme="dark"
          mode="horizontal"
          defaultSelectedKeys={['2']}
          style={{ lineHeight: '64px', fontSize: '125%' }}
        >
          <Menu.Item key="1">menu 1</Menu.Item>
          <Menu.Item key="2">menu 2</Menu.Item>
          <Menu.Item key="3">menu 3</Menu.Item>
        </Menu>
      </Header>
    </Layout>
  );
}
.logo {
  width: 186px;
  height: 48px;
  background-color: red;
  margin: 8px 24px 8px 0;
  float: left;
}

I am using version 7.4.8.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the JSX and CSS reproduction in the issue, focusing on the horizontal Menu when it follows the floated .logo block. Inspect the menu's overflow-width calculation and verify the result with the provided layout: overflowed items should be computed and displayed correctly despite the preceding logo.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.