@@ -2057,7 +2057,9 @@ class PopupAnnotationElement extends AnnotationElement {
20572057 }
20582058
20592059 render ( ) {
2060- this . container . classList . add ( "popupAnnotation" ) ;
2060+ const { container } = this ;
2061+ container . classList . add ( "popupAnnotation" ) ;
2062+ container . role = "comment" ;
20612063
20622064 const popup = ( this . popup = new PopupElement ( {
20632065 container : this . container ,
@@ -2210,7 +2212,7 @@ class PopupElement {
22102212 popup . append ( header ) ;
22112213
22122214 if ( this . #dateObj) {
2213- const modificationDate = document . createElement ( "span " ) ;
2215+ const modificationDate = document . createElement ( "time " ) ;
22142216 modificationDate . classList . add ( "popupDate" ) ;
22152217 modificationDate . setAttribute (
22162218 "data-l10n-id" ,
@@ -2220,6 +2222,7 @@ class PopupElement {
22202222 "data-l10n-args" ,
22212223 JSON . stringify ( { dateObj : this . #dateObj. valueOf ( ) } )
22222224 ) ;
2225+ modificationDate . dateTime = this . #dateObj. toISOString ( ) ;
22232226 header . append ( modificationDate ) ;
22242227 }
22252228
@@ -3142,7 +3145,7 @@ class AnnotationLayer {
31423145 return this . #editableAnnotations. size > 0 ;
31433146 }
31443147
3145- async #appendElement( element , id ) {
3148+ async #appendElement( element , id , popupElements ) {
31463149 const contentElement = element . firstChild || element ;
31473150 const annotationId = ( contentElement . id = `${ AnnotationPrefix } ${ id } ` ) ;
31483151 const ariaAttributes =
@@ -3153,13 +3156,18 @@ class AnnotationLayer {
31533156 }
31543157 }
31553158
3156- this . div . append ( element ) ;
3157- this . #accessibilityManager?. moveElementInDOM (
3158- this . div ,
3159- element ,
3160- contentElement ,
3161- /* isRemovable = */ false
3162- ) ;
3159+ if ( popupElements ) {
3160+ // Set the popup just after the first element associated with the popup.
3161+ popupElements . at ( - 1 ) . container . after ( element ) ;
3162+ } else {
3163+ this . div . append ( element ) ;
3164+ this . #accessibilityManager?. moveElementInDOM (
3165+ this . div ,
3166+ element ,
3167+ contentElement ,
3168+ /* isRemovable = */ false
3169+ ) ;
3170+ }
31633171 }
31643172
31653173 /**
@@ -3227,7 +3235,7 @@ class AnnotationLayer {
32273235 if ( data . hidden ) {
32283236 rendered . style . visibility = "hidden" ;
32293237 }
3230- await this . #appendElement( rendered , data . id ) ;
3238+ await this . #appendElement( rendered , data . id , elementParams . elements ) ;
32313239
32323240 if ( element . _isEditable ) {
32333241 this . #editableAnnotations. set ( element . data . id , element ) ;
@@ -3263,7 +3271,7 @@ class AnnotationLayer {
32633271 continue ;
32643272 }
32653273 const rendered = element . render ( ) ;
3266- await this . #appendElement( rendered , data . id ) ;
3274+ await this . #appendElement( rendered , data . id , null ) ;
32673275 }
32683276 }
32693277
0 commit comments