diff --git a/docs/en-US/component/dropdown.md b/docs/en-US/component/dropdown.md index 464f568cc6..77a4feaca9 100644 --- a/docs/en-US/component/dropdown.md +++ b/docs/en-US/component/dropdown.md @@ -79,21 +79,22 @@ dropdown/sizes ## Dropdown Attributes -| Attribute | Description | Type | Accepted Values | Default | -| -------------- | ---------------------------------------------------------------------------------------------------- | --------------- | ------------------------------------------------------------------ | ------------------------------------------------------- | -| type | menu button type, refer to `Button` Component, only works when `split-button` is true | string | — | — | -| size | menu size, also works on the split button | string | large / default / small | default | -| max-height | the max height of menu | string / number | — | — | -| split-button | whether a button group is displayed | boolean | — | false | -| disabled | Whether to disable | boolean | — | false | -| placement | placement of pop menu | string | top/top-start/top-end/bottom/bottom-start/bottom-end | bottom | -| trigger | how to trigger | string | hover/click/contextmenu | hover | -| hide-on-click | whether to hide menu after clicking menu-item | boolean | — | true | -| show-timeout | Delay time before show a dropdown (only works when trigger is `hover`) | number | — | 250 | -| hide-timeout | Delay time before hide a dropdown (only works when trigger is `hover`) | number | — | 150 | -| tabindex | [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of Dropdown | number | — | 0 | -| popper-class | custom class name for Dropdown's dropdown | string | — | — | -| popper-options | [popper.js](https://popper.js.org/documentation.html) parameters | Object | refer to [popper.js](https://popper.js.org/documentation.html) doc | `{ boundariesElement: 'body', gpuAcceleration: false }` | +| Attribute | Description | Type | Accepted Values | Default | +| -------------- | --------------------------------------------------------------------------------------------------------------------- | --------------- | ------------------------------------------------------------------ | ------------------------------------------------------- | +| type | menu button type, refer to `Button` Component, only works when `split-button` is true | string | — | — | +| size | menu size, also works on the split button | string | large / default / small | default | +| max-height | the max height of menu | string / number | — | — | +| split-button | whether a button group is displayed | boolean | — | false | +| disabled | Whether to disable | boolean | — | false | +| placement | placement of pop menu | string | top/top-start/top-end/bottom/bottom-start/bottom-end | bottom | +| trigger | how to trigger | string | hover/click/contextmenu | hover | +| hide-on-click | whether to hide menu after clicking menu-item | boolean | — | true | +| show-timeout | Delay time before show a dropdown (only works when trigger is `hover`) | number | — | 250 | +| hide-timeout | Delay time before hide a dropdown (only works when trigger is `hover`) | number | — | 150 | +| role | The ARIA role attribute for the dropdown menu. Depending on the use case, you may want to change this to 'navigation' | string | — | 'menu' | +| tabindex | [tabindex](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex) of Dropdown | number | — | 0 | +| popper-class | custom class name for Dropdown's dropdown | string | — | — | +| popper-options | [popper.js](https://popper.js.org/documentation.html) parameters | Object | refer to [popper.js](https://popper.js.org/documentation.html) doc | `{ boundariesElement: 'body', gpuAcceleration: false }` | ## Dropdown Slots diff --git a/packages/components/dropdown/__tests__/dropdown.test.ts b/packages/components/dropdown/__tests__/dropdown.test.ts index 32e5e7948d..c0097b9cb2 100644 --- a/packages/components/dropdown/__tests__/dropdown.test.ts +++ b/packages/components/dropdown/__tests__/dropdown.test.ts @@ -4,6 +4,7 @@ import { describe, expect, test, vi } from 'vitest' import { rAF } from '@element-plus/test-utils/tick' import { EVENT_CODE } from '@element-plus/constants' import { ElTooltip } from '@element-plus/components/tooltip' +import Button from '@element-plus/components/button' import Dropdown from '../src/dropdown.vue' import DropdownItem from '../src/dropdown-item.vue' import DropdownMenu from '../src/dropdown-menu.vue' @@ -15,6 +16,7 @@ const CONTEXTMENU = 'contextmenu' const _mount = (template: string, data, otherObj?) => mount({ components: { + [Button.name]: Button, [Dropdown.name]: Dropdown, [DropdownItem.name]: DropdownItem, [DropdownMenu.name]: DropdownMenu, @@ -352,7 +354,7 @@ describe('Dropdown', () => { dropdown