Skip to content

Commit

Permalink
cci: fix banner inserted in wrong element
Browse files Browse the repository at this point in the history
  • Loading branch information
ChlodAlejandro committed Dec 21, 2023
1 parent 548da87 commit c577afa
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/session/DeputyRootSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ export default class DeputyRootSession {
window.deputy.session.init();
} );

firstHeading.insertAdjacentElement(
casePage.normalizeSectionHeading(
firstHeading
).insertAdjacentElement(
'beforebegin',
unwrapWidget( messageBox )
);
Expand All @@ -134,7 +136,9 @@ export default class DeputyRootSession {
const lastActiveSection =
DeputyRootSession.findFirstLastActiveSection( casePage );
const firstSection =
casePage.findFirstContributionSurveyHeading();
casePage.normalizeSectionHeading(
casePage.findFirstContributionSurveyHeading()
);

// Insert element directly into widget (not as text, or else event
// handlers will be destroyed).
Expand Down Expand Up @@ -216,7 +220,8 @@ export default class DeputyRootSession {
return mw.loader.using(
[ 'oojs-ui-core', 'oojs-ui.styles.icons-content' ],
() => {
const firstHeading = casePage.findFirstContributionSurveyHeading();
const firstHeading =
casePage.findFirstContributionSurveyHeading();
if ( firstHeading ) {
const messageBox = DeputyMessageWidget( {
classes: [
Expand All @@ -227,7 +232,9 @@ export default class DeputyRootSession {
message: mw.msg( 'deputy.session.tabActive.help' ),
closable: true
} );
firstHeading.insertAdjacentElement(
casePage.normalizeSectionHeading(
firstHeading
).insertAdjacentElement(
'beforebegin',
unwrapWidget( messageBox )
);
Expand Down

0 comments on commit c577afa

Please sign in to comment.