[MM-64617] Add enter key press handler to each of the modals (#3463)
This commit is contained in:
@@ -36,6 +36,7 @@ export default function DestructiveConfirmationModal(props: Props) {
|
||||
modalHeaderText={title}
|
||||
handleCancel={onCancel}
|
||||
handleConfirm={onAccept}
|
||||
handleEnterKeyPress={onAccept}
|
||||
confirmButtonText={acceptLabel}
|
||||
cancelButtonText={cancelLabel}
|
||||
confirmButtonClassName='btn-danger'
|
||||
|
@@ -124,7 +124,7 @@ export const Modal: React.FC<Props> = ({
|
||||
|
||||
const handleConfirmClick = async (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
||||
event.preventDefault();
|
||||
if (autoCloseOnConfirmButton) {
|
||||
if (autoCloseOnConfirmButton && !isConfirmDisabled) {
|
||||
await onHide();
|
||||
}
|
||||
handleConfirm?.();
|
||||
@@ -135,7 +135,7 @@ export const Modal: React.FC<Props> = ({
|
||||
if (event.nativeEvent.isComposing) {
|
||||
return;
|
||||
}
|
||||
if (autoCloseOnConfirmButton) {
|
||||
if (autoCloseOnConfirmButton && !isConfirmDisabled) {
|
||||
await onHide();
|
||||
}
|
||||
if (handleEnterKeyPress) {
|
||||
|
@@ -361,6 +361,7 @@ class NewServerModal extends React.PureComponent<Props, State> {
|
||||
onExited={this.props.unremoveable ? () => {} : this.props.onClose}
|
||||
modalHeaderText={this.getModalTitle()}
|
||||
confirmButtonText={this.getSaveButtonLabel()}
|
||||
handleEnterKeyPress={this.save}
|
||||
handleConfirm={this.save}
|
||||
isConfirmDisabled={!this.state.serverName.length || !this.state.validationResult || this.isServerURLErrored()}
|
||||
handleCancel={this.props.onClose}
|
||||
|
@@ -156,6 +156,7 @@ export default function SettingsModal({
|
||||
defaultMessage='Desktop App Settings'
|
||||
/>
|
||||
}
|
||||
autoCloseOnConfirmButton={false}
|
||||
headerContent={savingText}
|
||||
bodyDivider={true}
|
||||
bodyPadding={false}
|
||||
|
@@ -79,6 +79,7 @@ export default class ShowCertificateModal extends React.PureComponent<Props, Sta
|
||||
/>
|
||||
}
|
||||
handleConfirm={this.handleOk}
|
||||
handleEnterKeyPress={this.handleOk}
|
||||
>
|
||||
<dl>
|
||||
{certificateSection(
|
||||
|
Reference in New Issue
Block a user