react-component / react-component/menu
More than one menu items selected even if selectedKey has only one element in array
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 701
- Forks
- 266
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 3
Description
Im using antd latest version.
<Menu
inlineIndent={8}
theme="dark"
mode="inline"
selectedKeys={['roomtypes']}
>
<Menu.Item key={'roomtypes'}>Roomtypes</Menu.Item>
<Menu.Item key={'roomtypesOffset'}>Roomtypes Offset</Menu.Item>
</Menu>
file: https://github.com/react-component/menu/blob/master/src/MenuItem.tsx
isSelected: selectedKeys.indexOf(eventKey) !== -1,
Here isSelected true for both eventKey roomtypes and roomtypesOffset
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/MenuItem.tsx at the isSelected calculation cited in the issue, then reproduce the example with selectedKeys set to ['roomtypes']. Trace how eventKey matching is performed and check the existing menu tests or test entry points before changing behavior. Done means only the item whose key exactly matches roomtypes is selected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100