Merge pull request #5618 from matrix-org/travis/rel-stickerpickerfix

[Release] Fix z-index of stickerpicker
This commit is contained in:
Travis Ralston 2021-02-04 03:00:38 -07:00 committed by GitHub
commit 20e6501366
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -23,6 +23,7 @@ import ResizeObserver from 'resize-observer-polyfill';
import dis from '../../../dispatcher/dispatcher'; import dis from '../../../dispatcher/dispatcher';
import MatrixClientContext from "../../../contexts/MatrixClientContext"; import MatrixClientContext from "../../../contexts/MatrixClientContext";
import {MatrixClientPeg} from "../../../MatrixClientPeg"; import {MatrixClientPeg} from "../../../MatrixClientPeg";
import {isNullOrUndefined} from "matrix-js-sdk/src/utils";
// Shamelessly ripped off Modal.js. There's probably a better way // Shamelessly ripped off Modal.js. There's probably a better way
// of doing reusable widgets like dialog boxes & menus where we go and // of doing reusable widgets like dialog boxes & menus where we go and
@ -61,6 +62,9 @@ export default class PersistedElement extends React.Component {
// Any PersistedElements with the same persistKey will use // Any PersistedElements with the same persistKey will use
// the same DOM container. // the same DOM container.
persistKey: PropTypes.string.isRequired, persistKey: PropTypes.string.isRequired,
// z-index for the element. Defaults to 9.
zIndex: PropTypes.number,
}; };
constructor() { constructor() {
@ -165,7 +169,7 @@ export default class PersistedElement extends React.Component {
const parentRect = parent.getBoundingClientRect(); const parentRect = parent.getBoundingClientRect();
Object.assign(child.style, { Object.assign(child.style, {
zIndex: 9, zIndex: isNullOrUndefined(this.props.zIndex) ? 9 : this.props.zIndex,
position: 'absolute', position: 'absolute',
top: parentRect.top + 'px', top: parentRect.top + 'px',
left: parentRect.left + 'px', left: parentRect.left + 'px',

View file

@ -264,7 +264,7 @@ export default class Stickerpicker extends React.Component {
width: this.popoverWidth, width: this.popoverWidth,
}} }}
> >
<PersistedElement persistKey={PERSISTED_ELEMENT_KEY} style={{zIndex: STICKERPICKER_Z_INDEX}}> <PersistedElement persistKey={PERSISTED_ELEMENT_KEY} zIndex={STICKERPICKER_Z_INDEX}>
<AppTile <AppTile
app={stickerApp} app={stickerApp}
room={this.props.room} room={this.props.room}