From 3ceda311b6d876224a088753a5e9be4e27bd5cd5 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 29 Aug 2017 19:55:09 +0800 Subject: [PATCH] menu cannot be selectable in dropdown defaultly --- components/dropdown/dropdown.tsx | 5 +++++ components/dropdown/index.en-US.md | 2 +- components/dropdown/index.zh-CN.md | 2 +- components/menu/index.tsx | 1 - 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/dropdown/dropdown.tsx b/components/dropdown/dropdown.tsx index 644673af1c..2cccd591d2 100644 --- a/components/dropdown/dropdown.tsx +++ b/components/dropdown/dropdown.tsx @@ -48,8 +48,13 @@ export default class Dropdown extends React.Component { const dropdownTrigger = cloneElement(children as any, { className: classNames((children as any).props.className, `${prefixCls}-trigger`), }); + // menu cannot be selectable in dropdown defaultly + const overlayProps = overlay && (overlay as any).props; + const selectable = (overlayProps && 'selectable' in overlayProps) + ? overlayProps.selectable : false; const fixedModeOverlay = cloneElement(overlay as any, { mode: 'vertical', + selectable, }); return ( Warning: You must set a unique `key` for `Menu.Item`. -> Remove the highlighted style after click menu item via ``. +> Menu of Dropdown is unselectable defaultly, you can make it selectable via ``. ### Dropdown.Button diff --git a/components/dropdown/index.zh-CN.md b/components/dropdown/index.zh-CN.md index 3f7d45ec8c..2ec9c9c2ec 100644 --- a/components/dropdown/index.zh-CN.md +++ b/components/dropdown/index.zh-CN.md @@ -28,7 +28,7 @@ title: Dropdown > 注意: Menu.Item 必须设置唯一的 key 属性。 -> 如果希望去掉菜单选中的背景效果,可以指定 ``. +> Dropdown 下的 Menu 默认不可选中。如果需要菜单可选中,可以指定 ``. ### Dropdown.Button diff --git a/components/menu/index.tsx b/components/menu/index.tsx index 4fd9aee5e4..629aa3ee5a 100644 --- a/components/menu/index.tsx +++ b/components/menu/index.tsx @@ -55,7 +55,6 @@ export default class Menu extends React.Component { prefixCls: 'ant-menu', className: '', theme: 'light', // or dark - selectable: true, }; static childContextTypes = { inlineCollapsed: PropTypes.bool,