File tree Expand file tree Collapse file tree
src/components/notification Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import {
2323import { EuiButtonEmpty , EuiButtonEmptyProps } from '../button' ;
2424import { EuiLink } from '../link' ;
2525import { EuiContextMenuItem , EuiContextMenuItemProps } from '../context_menu' ;
26- import { htmlIdGenerator } from '../../services' ;
26+ import { useGeneratedHtmlId } from '../../services' ;
2727import { EuiNotificationEventReadIcon } from './notification_event_read_icon' ;
2828
2929export type EuiNotificationHeadingLevel = 'h2' | 'h3' | 'h4' | 'h5' | 'h6' ;
@@ -113,7 +113,7 @@ export const EuiNotificationEvent: FunctionComponent<EuiNotificationEventProps>
113113 'euiNotificationEvent__title--isRead' : isRead ,
114114 } ) ;
115115
116- const randomHeadingId = htmlIdGenerator ( ) ( ) ;
116+ const randomHeadingId = useGeneratedHtmlId ( ) ;
117117
118118 const titleProps = {
119119 id : randomHeadingId ,
Original file line number Diff line number Diff line change 88
99import React , { FunctionComponent , useState } from 'react' ;
1010import { EuiAccordion } from '../accordion' ;
11- import { htmlIdGenerator } from '../../services' ;
11+ import { useGeneratedHtmlId } from '../../services' ;
1212import { useEuiI18n } from '../i18n' ;
1313import { EuiText } from '../text' ;
1414
@@ -30,6 +30,10 @@ export const EuiNotificationEventMessages: FunctionComponent<EuiNotificationEven
3030 const [ isOpen , setIsOpen ] = useState ( false ) ;
3131 const messagesLength = messages . length ;
3232
33+ const accordionId = useGeneratedHtmlId ( {
34+ prefix : 'euiNotificationEventMessagesAccordion' ,
35+ } ) ;
36+
3337 const accordionButtonText = useEuiI18n (
3438 'euiNotificationEventMessages.accordionButtonText' ,
3539 '+ {messagesLength} more' ,
@@ -69,7 +73,7 @@ export const EuiNotificationEventMessages: FunctionComponent<EuiNotificationEven
6973 < EuiAccordion
7074 onToggle = { setIsOpen }
7175 buttonProps = { { 'aria-label' : accordionAriaLabelButtonText } }
72- id = { htmlIdGenerator ( 'euiNotificationEventMessagesAccordion' ) ( ) }
76+ id = { accordionId }
7377 className = "euiNotificationEventMessages__accordion"
7478 buttonContent = { buttonContentText }
7579 buttonClassName = "euiNotificationEventMessages__accordionButton"
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ import {
2323 EuiContextMenuPanel ,
2424} from '../context_menu' ;
2525import { EuiI18n } from '../i18n' ;
26- import { htmlIdGenerator } from '../../services' ;
26+ import { useGeneratedHtmlId } from '../../services' ;
2727
2828export type EuiNotificationEventMetaProps = {
2929 id : string ;
@@ -85,7 +85,7 @@ export const EuiNotificationEventMeta: FunctionComponent<EuiNotificationEventMet
8585 ReturnType < NonNullable < typeof onOpenContextMenu > >
8686 > ( [ ] ) ;
8787
88- const randomPopoverId = htmlIdGenerator ( ) ( ) ;
88+ const randomPopoverId = useGeneratedHtmlId ( ) ;
8989
9090 const ariaAttribute = iconAriaLabel
9191 ? { 'aria-label' : iconAriaLabel }
You can’t perform that action at this time.
0 commit comments