diff --git a/CHANGES b/CHANGES index 23c51bc3..5e020250 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +## 13.2.1 + +---- + +- Added screen reader texts to aria-label instead of having them in hidden span-tags + ## 13.2.0 ---- diff --git a/package.json b/package.json index 8cf0572b..b6d0fe16 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@helsenorge/refero", - "version": "13.2.0", + "version": "13.2.1", "engines": { "node": "^18.0.0", "npm": ">=9.0.0" diff --git a/src/util/index.ts b/src/util/index.ts index 6c791846..a659673f 100644 --- a/src/util/index.ts +++ b/src/util/index.ts @@ -184,9 +184,6 @@ function getMarkdownValue( questionnaire?: Questionnaire | null, srLinkText?: string ): string { - const srLinkTextSpan = `${ - srLinkText ? srLinkText : 'The link opens in a new tab' - }`; const itemValue = getHyperlinkExtensionValue(item); const questionnaireValue = questionnaire ? getHyperlinkExtensionValue(questionnaire) : undefined; @@ -194,14 +191,16 @@ function getMarkdownValue( renderer.link = (href: string, title: string, text: string): string => { const urlString = `${text}${srLinkTextSpan}`; + } target="_blank" rel="noopener noreferrer" class="external" aria-label=${ + openNewIfAbsolute(href) === '_blank' ? srLinkText : '' + }>${text}`; return urlString; }; const rendererSameWindow = new marked.Renderer(); rendererSameWindow.link = (href: string, title: string, text: string): string => { const urlString = `${text}${openNewIfAbsolute(href) === '_blank' ? srLinkTextSpan : ''}`; + )}" rel="noopener noreferrer" aria-label=${openNewIfAbsolute(href) === '_blank' ? srLinkText : ''}>${text}`; return urlString; };