Fix help page not closing from keybind

This commit is contained in:
Ajay
2022-06-09 14:02:23 -04:00
parent 32a3cb2cfe
commit 25c04a49c1
4 changed files with 7 additions and 6 deletions

View File

@@ -163,7 +163,7 @@ class SubmissionNoticeComponent extends React.Component<SubmissionNoticeProps, S
this.guidelinesReminder?.close(); this.guidelinesReminder?.close();
this.noticeRef.current.close(true); this.noticeRef.current.close(true);
this.contentContainer().resetSponsorSubmissionNotice(); this.contentContainer().resetSponsorSubmissionNotice(false);
this.props.closeListener(); this.props.closeListener();
} }

View File

@@ -1878,8 +1878,8 @@ function dontShowNoticeAgain() {
/** /**
* Helper method for the submission notice to clear itself when it closes * Helper method for the submission notice to clear itself when it closes
*/ */
function resetSponsorSubmissionNotice() { function resetSponsorSubmissionNotice(callRef = true) {
submissionNotice?.close(); submissionNotice?.close(callRef);
submissionNotice = null; submissionNotice = null;
} }

View File

@@ -35,7 +35,7 @@ class SubmissionNotice {
contentContainer={contentContainer} contentContainer={contentContainer}
callback={callback} callback={callback}
ref={this.noticeRef} ref={this.noticeRef}
closeListener={() => this.close()} />, closeListener={() => this.close(false)} />,
this.noticeElement this.noticeElement
); );
} }
@@ -44,7 +44,8 @@ class SubmissionNotice {
this.noticeRef.current.forceUpdate(); this.noticeRef.current.forceUpdate();
} }
close(): void { close(callRef = true): void {
if (callRef) this.noticeRef.current.cancel();
ReactDOM.unmountComponentAtNode(this.noticeElement); ReactDOM.unmountComponentAtNode(this.noticeElement);
this.noticeElement.remove(); this.noticeElement.remove();

View File

@@ -16,7 +16,7 @@ export interface ContentContainer {
updatePreviewBar: () => void, updatePreviewBar: () => void,
onMobileYouTube: boolean, onMobileYouTube: boolean,
sponsorSubmissionNotice: SubmissionNotice, sponsorSubmissionNotice: SubmissionNotice,
resetSponsorSubmissionNotice: () => void, resetSponsorSubmissionNotice: (callRef?: boolean) => void,
updateEditButtonsOnPlayer: () => void, updateEditButtonsOnPlayer: () => void,
previewTime: (time: number, unpause?: boolean) => void, previewTime: (time: number, unpause?: boolean) => void,
videoInfo: VideoInfo, videoInfo: VideoInfo,