File tree Expand file tree Collapse file tree
src/DfE.ExternalApplications.Web Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11@page
22@model DfE .ExternalApplications .Web .Pages .Notifications .IndexModel
3+ @{
4+ ViewData [" Title" ] = " Notifications" ;
5+ }
36
47<h1 class =" govuk-heading-l" >Notifications</h1 >
58
4952 <td class =" govuk-table__cell" >${ n .message || ' ' } </td >
5053 <td class =" govuk-table__cell" >${ mapTypeTag (n .type )} </td >
5154 <td class =" govuk-table__cell" >${ dateStr} </td >
52- <td class =" govuk-table__cell" ><a class =" govuk-link" data-id =" ${n.id}" href =" #" >Dismiss</a ></td >
55+ <td class =" govuk-table__cell" ><a class =" govuk-link" data-id =" ${n.id}" href =" #" >Dismiss < span class = " govuk-visually-hidden " >this notification</ span > </a ></td >
5356 ` ;
5457 tr .querySelector (' a' ).onclick = async (e ) => {
5558 e .preventDefault ();
6164 headers: { ' RequestVerificationToken' : antiForgeryToken () }
6265 });
6366 if (response .ok ) {
64- tr .remove ();
67+ tr .innerHTML = ' <td class="govuk-table__cell" aria-live="assertive" role="alert" colspan="4">Notification dismissed.</td>' ;
68+ setTimeout (() => tr .remove (), 3000 );
6569 } else {
6670 console .error (' Failed to dismiss notification:' , response .status , await response .text ());
6771 alert (' Failed to dismiss notification. Please try again.' );
Original file line number Diff line number Diff line change 188188 <li class =" govuk-service-navigation__item" >
189189 <a class =" govuk-service-navigation__link app-badge-container" href =" /Notifications" style =" position : relative ;" >
190190 Notifications
191+ <span id =" notifications-unread-sr" class =" govuk-visually-hidden" ></span >
191192 <span id =" notifications-unread-badge" class =" app-notifications-badge" aria-hidden =" true" ></span >
192193 </a >
193194 </li >
Original file line number Diff line number Diff line change 22
33const container = ( ) => document . getElementById ( 'notification-container' ) ;
44const unreadBadge = ( ) => document . getElementById ( 'notifications-unread-badge' ) ;
5+ const unreadSr = ( ) => document . getElementById ( 'notifications-unread-sr' ) ;
56const antiForgeryToken = ( ) => {
67 const input = document . querySelector ( 'input[name="__RequestVerificationToken"]' ) ;
78 return input ?. value ;
@@ -115,9 +116,12 @@ async function refreshUnreadCount() {
115116 const unread = await fetch ( `/notifications/unread` , { credentials : 'include' } ) . then ( r => r . ok ? r . json ( ) : [ ] ) ;
116117 const count = Array . isArray ( unread ) ? unread . length : 0 ;
117118 const badge = unreadBadge ( ) ;
119+ const notificationsUnreadSr = unreadSr ( ) ;
118120 if ( ! badge ) return ;
119121 if ( count > 0 ) {
120122 badge . textContent = count > 99 ? '99+' : String ( count ) ;
123+ const accessibleCount = count > 99 ? 'over 99' : String ( count ) ;
124+ notificationsUnreadSr . textContent = `(You have ${ accessibleCount } unread ${ count === 1 ? 'notification' : 'notifications' } )` ;
121125 // Ensure visual badge even if CSS fails to load (24x24 circle)
122126 badge . style . display = 'inline-block' ;
123127 badge . style . position = 'absolute' ;
@@ -135,6 +139,7 @@ async function refreshUnreadCount() {
135139 badge . style . zIndex = '2' ;
136140 } else {
137141 badge . textContent = '' ;
142+ notificationsUnreadSr . textContent = '(You have no unread notifications)' ;
138143 badge . style . display = 'none' ;
139144 }
140145 } catch { }
You can’t perform that action at this time.
0 commit comments