@@ -276,7 +276,10 @@ class AnnotationElement {
276276
277277 const container = document . createElement ( "section" ) ;
278278 container . setAttribute ( "data-annotation-id" , data . id ) ;
279- if ( ! ( this instanceof WidgetAnnotationElement ) ) {
279+ if (
280+ ! ( this instanceof WidgetAnnotationElement ) &&
281+ ! ( this instanceof LinkAnnotationElement )
282+ ) {
280283 container . tabIndex = 0 ;
281284 }
282285 const { style } = container ;
@@ -797,16 +800,21 @@ class LinkAnnotationElement extends AnnotationElement {
797800 linkService . addLinkAttributes ( link , data . url , data . newWindow ) ;
798801 isBound = true ;
799802 } else if ( data . action ) {
800- this . _bindNamedAction ( link , data . action ) ;
803+ this . _bindNamedAction ( link , data . action , data . overlaidText ) ;
801804 isBound = true ;
802805 } else if ( data . attachment ) {
803- this . #bindAttachment( link , data . attachment , data . attachmentDest ) ;
806+ this . #bindAttachment(
807+ link ,
808+ data . attachment ,
809+ data . overlaidText ,
810+ data . attachmentDest
811+ ) ;
804812 isBound = true ;
805813 } else if ( data . setOCGState ) {
806- this . #bindSetOCGState( link , data . setOCGState ) ;
814+ this . #bindSetOCGState( link , data . setOCGState , data . overlaidText ) ;
807815 isBound = true ;
808816 } else if ( data . dest ) {
809- this . _bindLink ( link , data . dest ) ;
817+ this . _bindLink ( link , data . dest , data . overlaidText ) ;
810818 isBound = true ;
811819 } else {
812820 if (
@@ -848,9 +856,10 @@ class LinkAnnotationElement extends AnnotationElement {
848856 * @private
849857 * @param {Object } link
850858 * @param {Object } destination
859+ * @param {string } [overlaidText]
851860 * @memberof LinkAnnotationElement
852861 */
853- _bindLink ( link , destination ) {
862+ _bindLink ( link , destination , overlaidText = "" ) {
854863 link . href = this . linkService . getDestinationHash ( destination ) ;
855864 link . onclick = ( ) => {
856865 if ( destination ) {
@@ -861,6 +870,9 @@ class LinkAnnotationElement extends AnnotationElement {
861870 if ( destination || destination === /* isTooltipOnly = */ "" ) {
862871 this . #setInternalLink( ) ;
863872 }
873+ if ( overlaidText ) {
874+ link . title = overlaidText ;
875+ }
864876 }
865877
866878 /**
@@ -869,27 +881,34 @@ class LinkAnnotationElement extends AnnotationElement {
869881 * @private
870882 * @param {Object } link
871883 * @param {Object } action
884+ * @param {string } [overlaidText]
872885 * @memberof LinkAnnotationElement
873886 */
874- _bindNamedAction ( link , action ) {
887+ _bindNamedAction ( link , action , overlaidText = "" ) {
875888 link . href = this . linkService . getAnchorUrl ( "" ) ;
876889 link . onclick = ( ) => {
877890 this . linkService . executeNamedAction ( action ) ;
878891 return false ;
879892 } ;
893+ if ( overlaidText ) {
894+ link . title = overlaidText ;
895+ }
880896 this . #setInternalLink( ) ;
881897 }
882898
883899 /**
884900 * Bind attachments to the link element.
885901 * @param {Object } link
886902 * @param {Object } attachment
887- * @param {str } [dest]
903+ * @param {string } [overlaidText]
904+ * @param {string } [dest]
888905 */
889- #bindAttachment( link , attachment , dest = null ) {
906+ #bindAttachment( link , attachment , overlaidText = "" , dest = null ) {
890907 link . href = this . linkService . getAnchorUrl ( "" ) ;
891908 if ( attachment . description ) {
892909 link . title = attachment . description ;
910+ } else if ( overlaidText ) {
911+ link . title = overlaidText ;
893912 }
894913 link . onclick = ( ) => {
895914 this . downloadManager ?. openOrDownloadData (
@@ -906,13 +925,17 @@ class LinkAnnotationElement extends AnnotationElement {
906925 * Bind SetOCGState actions to the link element.
907926 * @param {Object } link
908927 * @param {Object } action
928+ * @param {string } [overlaidText]
909929 */
910- #bindSetOCGState( link , action ) {
930+ #bindSetOCGState( link , action , overlaidText = "" ) {
911931 link . href = this . linkService . getAnchorUrl ( "" ) ;
912932 link . onclick = ( ) => {
913933 this . linkService . executeSetOCGState ( action ) ;
914934 return false ;
915935 } ;
936+ if ( overlaidText ) {
937+ link . title = overlaidText ;
938+ }
916939 this . #setInternalLink( ) ;
917940 }
918941
@@ -947,6 +970,9 @@ class LinkAnnotationElement extends AnnotationElement {
947970 return false ;
948971 } ;
949972 }
973+ if ( data . overlaidText ) {
974+ link . title = data . overlaidText ;
975+ }
950976
951977 if ( ! link . onclick ) {
952978 link . onclick = ( ) => false ;
0 commit comments