File tree 1 file changed +6
-1
lines changed
packages/coreui-react/src/components/popover
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -99,7 +99,8 @@ export const CPopover = forwardRef<HTMLDivElement, CPopoverProps>(
99
99
const popoverRef = useRef ( null )
100
100
const togglerRef = useRef ( null )
101
101
const forkedRef = useForkedRef ( ref , popoverRef )
102
-
102
+ const uID = useRef ( `popover${ Math . floor ( Math . random ( ) * 1_000_000 ) } ` )
103
+
103
104
const { initPopper, destroyPopper } = usePopper ( )
104
105
const [ _visible , setVisible ] = useState ( visible )
105
106
@@ -155,6 +156,9 @@ export const CPopover = forwardRef<HTMLDivElement, CPopoverProps>(
155
156
return (
156
157
< >
157
158
{ React . cloneElement ( children as React . ReactElement < any > , {
159
+ ...( _visible && {
160
+ 'aria-describedby' : uID . current ,
161
+ } ) ,
158
162
ref : togglerRef ,
159
163
...( ( trigger === 'click' || trigger . includes ( 'click' ) ) && {
160
164
onClick : ( ) => toggleVisible ( ! _visible ) ,
@@ -194,6 +198,7 @@ export const CPopover = forwardRef<HTMLDivElement, CPopoverProps>(
194
198
} ,
195
199
className ,
196
200
) }
201
+ id = { uID . current }
197
202
ref = { forkedRef }
198
203
role = "tooltip"
199
204
{ ...rest }
You can’t perform that action at this time.
0 commit comments