File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
packages/coreui-react/src/components/popover Expand file tree Collapse file tree 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>(
9999 const popoverRef = useRef ( null )
100100 const togglerRef = useRef ( null )
101101 const forkedRef = useForkedRef ( ref , popoverRef )
102-
102+ const uID = useRef ( `popover${ Math . floor ( Math . random ( ) * 1_000_000 ) } ` )
103+
103104 const { initPopper, destroyPopper } = usePopper ( )
104105 const [ _visible , setVisible ] = useState ( visible )
105106
@@ -155,6 +156,9 @@ export const CPopover = forwardRef<HTMLDivElement, CPopoverProps>(
155156 return (
156157 < >
157158 { React . cloneElement ( children as React . ReactElement < any > , {
159+ ...( _visible && {
160+ 'aria-describedby' : uID . current ,
161+ } ) ,
158162 ref : togglerRef ,
159163 ...( ( trigger === 'click' || trigger . includes ( 'click' ) ) && {
160164 onClick : ( ) => toggleVisible ( ! _visible ) ,
@@ -194,6 +198,7 @@ export const CPopover = forwardRef<HTMLDivElement, CPopoverProps>(
194198 } ,
195199 className ,
196200 ) }
201+ id = { uID . current }
197202 ref = { forkedRef }
198203 role = "tooltip"
199204 { ...rest }
You can’t perform that action at this time.
0 commit comments