Skip to content

Commit

Permalink
chore(mainnav): handle disabled item
Browse files Browse the repository at this point in the history
  • Loading branch information
tonghauhive committed Feb 25, 2025
1 parent a7a7a2e commit 2d79f8a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Mainnav/sgds-mainnav-item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ export class SgdsMainnavItem extends SgdsElement {
return console.error("More than one anchor tag is added to sgds-sidenav-item");
} else if (anchorItems.length === 1) {
const anchor = anchorItems[0] as HTMLAnchorElement;
this.disabled && anchor.setAttribute("tabindex", "-1");
this.active && anchor.setAttribute("aria-current", "true");
if (this.disabled) {
anchor.setAttribute("href", "javascript:void(0)");
anchor.setAttribute("tabindex", "-1");
}
}
}

Expand Down

0 comments on commit 2d79f8a

Please sign in to comment.