@@ -50,6 +50,8 @@ class ReleaseNotesView {
5050 return ;
5151 }
5252 const section = body . preview_section ;
53+ // Full (un-truncated) notes for the "Read full release notes" modal.
54+ this . _fullSection = body . full_section || null ;
5355 const eyebrow = section . is_unreleased
5456 ? "What's coming"
5557 : "What's new" ;
@@ -59,6 +61,9 @@ class ReleaseNotesView {
5961 const installed = body . current_installed_version
6062 ? `<p class="update-release-notes__date">Installed: v${ this . _escape ( body . current_installed_version ) } </p>`
6163 : '' ;
64+ const moreBtn = ( this . _fullSection && ( this . _fullSection . bullets || [ ] ) . length )
65+ ? '<button type="button" class="update-release-notes__more" data-rn-more>Read full release notes</button>'
66+ : '' ;
6267 this . root . dataset . state = 'ready' ;
6368 this . root . innerHTML = `
6469 <header class="update-release-notes__head">
@@ -70,7 +75,44 @@ class ReleaseNotesView {
7075 <ul class="update-release-notes__list">
7176 ${ bullets || '<li class="update-release-notes__empty">No bullets in this section.</li>' }
7277 </ul>
78+ ${ moreBtn }
79+ ` ;
80+ this . root . querySelector ( '[data-rn-more]' )
81+ ?. addEventListener ( 'click' , ( ) => this . _openFullModal ( ) ) ;
82+ }
83+
84+ _openFullModal ( ) {
85+ if ( ! this . _fullSection ) return ;
86+ const s = this . _fullSection ;
87+ const title = s . header || s . version || 'Release notes' ;
88+ const overlay = document . createElement ( 'div' ) ;
89+ overlay . className = 'rn-modal-overlay' ;
90+ overlay . setAttribute ( 'role' , 'dialog' ) ;
91+ overlay . setAttribute ( 'aria-modal' , 'true' ) ;
92+ overlay . setAttribute ( 'aria-label' , 'Full release notes' ) ;
93+ overlay . innerHTML = `
94+ <div class="rn-modal">
95+ <header class="rn-modal__head">
96+ <h3 class="rn-modal__title">${ this . _escape ( title ) } </h3>
97+ <button type="button" class="rn-modal__close" aria-label="Close">×</button>
98+ </header>
99+ <ul class="rn-modal__list update-release-notes__list">
100+ ${ this . _renderBullets ( s . bullets || [ ] ) }
101+ </ul>
102+ </div>
73103 ` ;
104+ const close = ( ) => {
105+ overlay . remove ( ) ;
106+ document . removeEventListener ( 'keydown' , onKey ) ;
107+ } ;
108+ const onKey = ( e ) => { if ( e . key === 'Escape' ) close ( ) ; } ;
109+ overlay . addEventListener ( 'click' , ( e ) => {
110+ if ( e . target === overlay ) close ( ) ;
111+ } ) ;
112+ overlay . querySelector ( '.rn-modal__close' ) . addEventListener ( 'click' , close ) ;
113+ document . addEventListener ( 'keydown' , onKey ) ;
114+ document . body . appendChild ( overlay ) ;
115+ overlay . querySelector ( '.rn-modal__close' ) . focus ( ) ;
74116 }
75117
76118 _renderBullets ( bullets ) {
0 commit comments