File tree 2 files changed +39
-2
lines changed
2 files changed +39
-2
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import type { TriggerProps } from '@rc-component/trigger' ;
3
+ import ConfigProvider from '../../config-provider' ;
3
4
4
5
import type { DropDownProps } from '..' ;
5
6
import Dropdown from '..' ;
@@ -376,4 +377,36 @@ describe('Dropdown', () => {
376
377
) . toBeInTheDocument ( ) ;
377
378
expect ( container . querySelector ( '.ant-dropdown-menu-item-extra' ) ?. textContent ) . toBe ( text ) ;
378
379
} ) ;
380
+
381
+ it ( 'should show correct arrow direction in rtl mode' , ( ) => {
382
+ const items = [
383
+ {
384
+ key : '1' ,
385
+ label : 'sub menu' ,
386
+ children : [
387
+ {
388
+ key : '1-1' ,
389
+ label : '1rd menu item' ,
390
+ } ,
391
+ {
392
+ key : '1-2' ,
393
+ label : '2th menu item' ,
394
+ } ,
395
+ ] ,
396
+ } ,
397
+ ] ;
398
+
399
+ const { container } = render (
400
+ < ConfigProvider direction = "rtl" >
401
+ < Dropdown menu = { { items, openKeys : [ '2' ] } } open autoAdjustOverflow = { false } >
402
+ < a onClick = { ( e ) => e . preventDefault ( ) } > Cascading menu</ a >
403
+ </ Dropdown >
404
+ </ ConfigProvider > ,
405
+ ) ;
406
+ expect (
407
+ container . querySelector (
408
+ '.ant-dropdown-menu-submenu-arrow .ant-dropdown-menu-submenu-arrow-icon' ,
409
+ ) ,
410
+ ) . toHaveClass ( 'anticon-left' ) ;
411
+ } ) ;
379
412
} ) ;
Original file line number Diff line number Diff line change 1
1
import * as React from 'react' ;
2
+ import LeftOutlined from '@ant-design/icons/LeftOutlined' ;
2
3
import RightOutlined from '@ant-design/icons/RightOutlined' ;
3
4
import type { AlignType } from '@rc-component/trigger' ;
4
5
import classNames from 'classnames' ;
@@ -252,14 +253,17 @@ const Dropdown: CompoundedComponent = (props) => {
252
253
overlayNode = React . Children . only (
253
254
typeof overlayNode === 'string' ? < span > { overlayNode } </ span > : overlayNode ,
254
255
) ;
255
-
256
256
return (
257
257
< OverrideProvider
258
258
prefixCls = { `${ prefixCls } -menu` }
259
259
rootClassName = { classNames ( cssVarCls , rootCls ) }
260
260
expandIcon = {
261
261
< span className = { `${ prefixCls } -menu-submenu-arrow` } >
262
- < RightOutlined className = { `${ prefixCls } -menu-submenu-arrow-icon` } />
262
+ { direction === 'rtl' ? (
263
+ < LeftOutlined className = { `${ prefixCls } -menu-submenu-arrow-icon` } />
264
+ ) : (
265
+ < RightOutlined className = { `${ prefixCls } -menu-submenu-arrow-icon` } />
266
+ ) }
263
267
</ span >
264
268
}
265
269
mode = "vertical"
You can’t perform that action at this time.
0 commit comments