/*
 * Copyright (c) 2018, 2026, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
const RULENAME="oj-acc-navigable-link";const DESCRIPTION="In order to be keyboard accessible, hyperlinks must be defined with either an 'href' or a 'tabindex' property (or both).";const SHORT_DESCRIPTION="Ensure that hyperlinks on the page are keyboard accessible";const HREF="href";const TABINDEX="tabindex";const COLON=":";class Rule{getName(){return RULENAME}getDescription(){return DESCRIPTION}getShortDescription(){return SHORT_DESCRIPTION}register(){return{"globtag(a)":this._onAnchor}}_onAnchor(ruleCtx,tagName){var attribs;if(attribs=ruleCtx.node.attribs){let a=Object.keys(attribs);let attrib,i;for(i=0;i<a.length;i++){attrib=a[i];attrib=attrib.charAt(0)===COLON?attrib.substring(1):attrib;if(attrib===HREF||attrib===TABINDEX){return}}}let msg="<a> must have an 'href' or 'tabindex' property to be keyboard accessible.";ruleCtx.reporter.addIssue(new ruleCtx.Issue(msg),ruleCtx)}}module.exports=Rule;