NG-ZORRO / ng-zorro-antd

Angular UI Component Library based on Ant Design
https://ng.ant.design
MIT License
8.86k stars 3.92k forks source link

Dropdown should support nzMouseEnterDelay and nzMouseLeaveDelay #4828

Open matulef opened 4 years ago

matulef commented 4 years ago

What problem does this feature solve?

Just like on the Tooltip and Popover component, the Dropdown component should support nzMouseEnterDelay and nzMouseLeaveDelay, to stop the dropdown from immediately opening or closing. You sometimes want to delay opening a Dropdown, for instance if you have many elements with attached Dropdowns and you don't want to change the UI every time the mouse quickly moves over one of them. The reasoning here is the same as with a Tooltip or Popover component.

Though it's not in the documentation, the nzMouseEnterDelay/nzMouseLeaveDelay properties seem to be supported by the React implementation of Ant Design. See here: https://github.com/ant-design/ant-design/blob/ccca0f34c24dd5c2a4db41634fcb4122d50fe385/components/dropdown/dropdown.tsx#L51

What does the proposed API look like?

The nzMouseEnterDelay and nzMouseLeaveDelay properties would exist on a Dropdown component, and behave exactly the same way they behave on Tooltip/Popover/Popconfirm components.

zuozhiw commented 2 years ago

We are love to see this API being added. We use "click" as drop down trigger and "click" shares the same 150ms delay with the "hover" trigger. It makes the user feel the dropdown is laggy when clicked.