From cf3e04e28a657e07540f6e4f1df505d71b37a4a4 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Wed, 22 Feb 2023 16:56:53 +0100 Subject: [PATCH] Apply suggestions from code review --- src/compiler/compile/nodes/Element.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index 123fb8d51c..a42f401f6e 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -621,7 +621,8 @@ export default class Element extends Node { const id_attribute = attribute_map.get('id'); const name_attribute = attribute_map.get('name'); const target_attribute = attribute_map.get('target'); - const aria_label_attribute = attribute_map.get('aria-label'); + const aria_label_attribute = attribute_map.get('aria-label'); + // links with target="_blank" should have noopener or noreferrer: https://developer.chrome.com/docs/lighthouse/best-practices/external-anchors-use-rel-noopener/ // modern browsers add noopener by default, so we only need to check legacy browsers // legacy browsers don't support noopener so we only check for noreferrer there @@ -642,12 +643,14 @@ export default class Element extends Node { } } } + if (aria_label_attribute) { const aria_value = aria_label_attribute.get_static_value(); if (aria_value != '') { this.contains_a11y_label = true; } } + if (href_attribute) { const href_value = href_attribute.get_static_value();