@@ -30,6 +30,7 @@ export class MDNPlayground extends L10nMixin(LitElement) {
3030
3131 static properties = {
3232 _gistID : { state : true } ,
33+ _showReportHintBanner : { state : true } ,
3334 } ;
3435
3536 constructor ( ) {
@@ -38,6 +39,8 @@ export class MDNPlayground extends L10nMixin(LitElement) {
3839 this . _autoRun = true ;
3940 /** @type {string | undefined } */
4041 this . _gistId = undefined ;
42+ /** @type {boolean } */
43+ this . _showReportHintBanner = false ;
4144 }
4245
4346 /** @type {Ref<MDNPlayController> } */
@@ -188,6 +191,7 @@ ${"```"}`,
188191
189192 if ( idParam ) {
190193 this . _gistId = idParam ;
194+ this . _showReportHintBanner = true ;
191195 }
192196
193197 const { srcPrefix : srcPrefixState , code } =
@@ -255,7 +259,16 @@ ${"```"}`,
255259 this . requestUpdate ( ) ;
256260 }
257261
262+ /** @param {Event } [event] */
263+ _dismissReportHintBanner ( event ) {
264+ if ( event && event instanceof Event ) {
265+ event . stopPropagation ( ) ;
266+ }
267+ this . _showReportHintBanner = false ;
268+ }
269+
258270 _reportOpen ( ) {
271+ this . _dismissReportHintBanner ( ) ;
259272 this . _reportModal . value ?. showModal ( ) ;
260273 }
261274
@@ -282,6 +295,22 @@ ${"```"}`,
282295 this . _user . run ( ) ;
283296 }
284297
298+ _renderReportHintBanner ( ) {
299+ return html `< button
300+ class ="playground__runner-report-hint-banner-button "
301+ @click =${ this . _reportOpen }
302+ >
303+ < span class ="report-hint "> Seeing something inappropriate?</ span >
304+ < span
305+ role ="button "
306+ class ="report-hint-banner-close-button "
307+ @click =${ this . _dismissReportHintBanner }
308+ aria-label =${ this . l10n `Close report hint banner` }
309+ > X</ span
310+ >
311+ </ button > ` ;
312+ }
313+
285314 render ( ) {
286315 const { code, initialCode } = this . _controller . value ?? { } ;
287316 const hasCode = Object . values ( code ?? { } ) . some ( Boolean ) ;
@@ -356,10 +385,8 @@ ${"```"}`,
356385 </ details >
357386 </ section >
358387 < section class ="playground__runner-console ">
359- ${ this . _gistId
360- ? html `< mdn-button @click =${ this . _reportOpen } variant ="plain">
361- Seeing something inappropriate?
362- </ mdn-button > `
388+ ${ this . _gistId && this . _showReportHintBanner
389+ ? html `${ this . _renderReportHintBanner ( ) } `
363390 : nothing }
364391 < mdn-play-runner > </ mdn-play-runner >
365392 < div class ="playground__console ">
0 commit comments