Remove extraenous DOM nodes

This commit is contained in:
Germain Souquet 2021-05-20 16:11:33 +01:00
parent f058fd8869
commit 9e55f24092
5 changed files with 27 additions and 29 deletions

View file

@ -389,7 +389,7 @@ export class ContextMenu extends React.PureComponent<IProps, IState> {
} }
render(): React.ReactChild { render(): React.ReactChild {
return ReactDOM.createPortal(this.renderMenu(), getOrCreateContainer()); return ReactDOM.createPortal(this.renderMenu(), document.body);
} }
} }

View file

@ -55,6 +55,7 @@ export default class ToastContainer extends React.Component<{}, IState> {
const totalCount = this.state.toasts.length; const totalCount = this.state.toasts.length;
const isStacked = totalCount > 1; const isStacked = totalCount > 1;
let toast; let toast;
let containerClasses;
if (totalCount !== 0) { if (totalCount !== 0) {
const topToast = this.state.toasts[0]; const topToast = this.state.toasts[0];
const {title, icon, key, component, className, props} = topToast; const {title, icon, key, component, className, props} = topToast;
@ -79,16 +80,17 @@ export default class ToastContainer extends React.Component<{}, IState> {
</div> </div>
<div className="mx_Toast_body">{React.createElement(component, toastProps)}</div> <div className="mx_Toast_body">{React.createElement(component, toastProps)}</div>
</div>); </div>);
}
const containerClasses = classNames("mx_ToastContainer", { containerClasses = classNames("mx_ToastContainer", {
"mx_ToastContainer_stacked": isStacked, "mx_ToastContainer_stacked": isStacked,
}); });
}
return ( return toast
? (
<div className={containerClasses} role="alert"> <div className={containerClasses} role="alert">
{toast} {toast}
</div> </div>
); )
: null;
} }
} }

View file

@ -257,8 +257,7 @@ export default class RoomHeader extends React.Component {
const e2eIcon = this.props.e2eStatus ? <E2EIcon status={this.props.e2eStatus} /> : undefined; const e2eIcon = this.props.e2eStatus ? <E2EIcon status={this.props.e2eStatus} /> : undefined;
return ( return (
<div className="mx_RoomHeader light-panel"> <div className="mx_RoomHeader mx_RoomHeader_wrapper light-panel" aria-owns="mx_RightPanel">
<div className="mx_RoomHeader_wrapper" aria-owns="mx_RightPanel">
<div className="mx_RoomHeader_avatar">{ roomAvatar }</div> <div className="mx_RoomHeader_avatar">{ roomAvatar }</div>
<div className="mx_RoomHeader_e2eIcon">{ e2eIcon }</div> <div className="mx_RoomHeader_e2eIcon">{ e2eIcon }</div>
{ name } { name }
@ -267,7 +266,6 @@ export default class RoomHeader extends React.Component {
{ rightRow } { rightRow }
<RoomHeaderButtons /> <RoomHeaderButtons />
</div> </div>
</div>
); );
} }
} }

View file

@ -62,15 +62,13 @@ export default class SimpleRoomHeader extends React.Component {
} }
return ( return (
<div className="mx_RoomHeader" > <div className="mx_RoomHeader mx_RoomHeader_wrapper" >
<div className="mx_RoomHeader_wrapper">
<div className="mx_RoomHeader_simpleHeader"> <div className="mx_RoomHeader_simpleHeader">
{ icon } { icon }
{ this.props.title } { this.props.title }
{ cancelButton } { cancelButton }
</div> </div>
</div> </div>
</div>
); );
} }
} }

View file

@ -204,7 +204,7 @@ export default class WhoIsTypingTile extends React.Component {
this.props.whoIsTypingLimit, this.props.whoIsTypingLimit,
); );
if (!typingString) { if (!typingString) {
return (<div className="mx_WhoIsTypingTile_empty" />); return null;
} }
return ( return (