1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-20 21:54:58 -04:00

Scrolling and hotkey improvements

New: Use Esc/Enter for cancel/accept in confirmation modals
Fixed: Modals focused when opened
Fixed: Scrolling with keyboard unless focus is shifted out of scrollable area
Closes #3291
This commit is contained in:
Mark McDowall
2020-03-01 21:03:38 -08:00
parent 52e5d4d0f1
commit 506023b0f3
7 changed files with 108 additions and 27 deletions
+21 -18
View File
@@ -1,6 +1,7 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import FocusLock from 'react-focus-lock';
import classNames from 'classnames';
import elementClass from 'element-class';
import getUniqueElememtId from 'Utilities/getUniqueElementId';
@@ -181,31 +182,33 @@ class Modal extends Component {
}
return ReactDOM.createPortal(
<div
className={styles.modalContainer}
>
<FocusLock disabled={false}>
<div
ref={this._setBackgroundRef}
className={backdropClassName}
onMouseDown={this.onBackdropBeginPress}
onMouseUp={this.onBackdropEndPress}
className={styles.modalContainer}
>
<div
className={classNames(
className,
styles[size]
)}
style={style}
ref={this._setBackgroundRef}
className={backdropClassName}
onMouseDown={this.onBackdropBeginPress}
onMouseUp={this.onBackdropEndPress}
>
<ErrorBoundary
errorComponent={ModalError}
onModalClose={onModalClose}
<div
className={classNames(
className,
styles[size]
)}
style={style}
>
{children}
</ErrorBoundary>
<ErrorBoundary
errorComponent={ModalError}
onModalClose={onModalClose}
>
{children}
</ErrorBoundary>
</div>
</div>
</div>
</div>,
</FocusLock>,
this._node
);
}