menu icon indicating copy to clipboard operation
menu copied to clipboard

Enter keydown on items in SubMenu

Open lipedeitos opened this issue 7 years ago • 5 comments

Hi!

I'm wrapping some RC features like rc-menu inside my own componentes. This is how I'm using them right now:

const menu = (
      <FFMenu onClick={(item) => { console.log(item.key); }}>
        <FFMenu.Item key="1" icon="person">Testando 1</FFMenu.Item>
        <FFMenu.Item key="2" icon="build">Testando 2</FFMenu.Item>
        <FFMenu.SubMenu key="3" icon="check" title="Testando 3">
          <FFMenu.Item key="3-1">Testando 3-1</FFMenu.Item>
          <FFMenu.Item key="3-2">Testando 3-2</FFMenu.Item>
          <FFMenu.Item key="3-3">Testando 3-3</FFMenu.Item>
          <FFMenu.Item key="3-4">Testando 3-4</FFMenu.Item>
        </FFMenu.SubMenu>
        <FFMenu.Item key="4" icon="credit_card">Testando 4</FFMenu.Item>
      </FFMenu>
);

So, as you can see in the component FFMenu i pass the "onClick" function. When i select the first item "Testando 1" and use arrows it'll navigate normally, when i press "Enter" the console.log(); shows up. The problem is that when I'm using the arrows in any Item inside a SubMenu when i press enter, it'll close the SubMenu, and will not select the Item that was "hovered/active".

Checked the demos and examples and seems to be the same thing. When we press enter in any item, the standard behavior should not be to "click" the item?

Sorry about my english and thanks for the attention.

lipedeitos avatar Jul 31 '17 18:07 lipedeitos

Yes, there are so many bugs while using keyboard, and we have no time to fix those bugs now. But PR is welcomed, thanks.

benjycui avatar Aug 03 '17 01:08 benjycui

Hello,

Please forgive me that I ask here, but how can I make all other SubMenus close, when I click on a MenuItem?

Thanks!

mr2day avatar Sep 26 '17 16:09 mr2day

@mr2day https://ant.design/components/menu/#components-menu-demo-sider-current

benjycui avatar Sep 27 '17 02:09 benjycui

Thanks a million! I didn't know about antd, will use all library in my project.

mr2day avatar Sep 27 '17 08:09 mr2day

Facing the same issue. Can't click links inside the submenu with keyboard.. Need help..

rajatkantinandi avatar Jun 07 '19 05:06 rajatkantinandi