@@ -45,6 +45,15 @@ export interface SimpleDialogProps extends ModalProps, TestableComponent {
4545 showFullScreenToggler ?: boolean ;
4646 /** Starts the modal in full screen mode. The show full screen toggler will be automatically enabled. */
4747 startInFullScreenMode ?: boolean ;
48+ /**
49+ * Texts for the full screen toggler, used as tooltip and accessible name of the button.
50+ * `maximize` is shown while the dialog is in its normal size, `minimize` while it is in full screen mode.
51+ * Defaults to "Show in full screen" and "Exit full screen".
52+ */
53+ fullScreenTogglerTexts ?: {
54+ maximize ?: string ;
55+ minimize ?: string ;
56+ } ;
4857 /** Forward properties to the actions footer component. */
4958 actionsProps ?: Omit < CardActionsProps , "inverseDirection" > ;
5059}
@@ -69,6 +78,7 @@ export const SimpleDialog = ({
6978 headerOptions,
7079 showFullScreenToggler = false ,
7180 startInFullScreenMode = false ,
81+ fullScreenTogglerTexts,
7282 size,
7383 role,
7484 "aria-labelledby" : ariaLabelledby ,
@@ -80,7 +90,9 @@ export const SimpleDialog = ({
8090 const dialogUniqueId = React . useId ( ) . replace ( / [ ^ a - z A - Z 0 - 9 _ - ] / g, "" ) ;
8191 const [ displayFullscreen , setDisplayFullscreen ] = React . useState < boolean > ( startInFullScreenMode ) ;
8292 const showToggler = startInFullScreenMode || showFullScreenToggler ;
83- const togglerText = displayFullscreen ? "Exit full screen" : "Show in full screen" ;
93+ const togglerText = displayFullscreen
94+ ? ( fullScreenTogglerTexts ?. minimize ?? "Exit full screen" )
95+ : ( fullScreenTogglerTexts ?. maximize ?? "Show in full screen" ) ;
8496 const intentClassName = intent ? `${ eccgui } -intent--${ intent } ` : "" ;
8597 const wrapperDivProps = {
8698 ...modalPreventEvents ,
@@ -118,6 +130,7 @@ export const SimpleDialog = ({
118130 < IconButton
119131 name = { displayFullscreen ? "toggler-minimize" : "toggler-maximize" }
120132 text = { togglerText }
133+ aria-label = { togglerText }
121134 onClick = { ( ) => setDisplayFullscreen ( ! displayFullscreen ) }
122135 />
123136 ) }
0 commit comments