Links of the quick nav component. Only first and second level links will be shown in the quick nav, due to
- design restrictions. Each link has the following properties:
+ design restrictions. The component automatically detects HashRouter usage and enables smooth scrolling
+ navigation when appropriate. Each link has the following properties:
label: Text to be shown in the link. The content must be wrapped with an id equal to the
diff --git a/packages/lib/src/quick-nav/QuickNav.tsx b/packages/lib/src/quick-nav/QuickNav.tsx
index aa9718fb7..4131314a8 100644
--- a/packages/lib/src/quick-nav/QuickNav.tsx
+++ b/packages/lib/src/quick-nav/QuickNav.tsx
@@ -61,6 +61,10 @@ const Link = styled.a`
export default function DxcQuickNav({ links, title }: QuickNavTypes) {
const translatedLabels = useContext(HalstackLanguageContext);
+ const isHashRouter = (): boolean => {
+ if (typeof window === "undefined") return false;
+ return window.location.href.includes("/#/");
+ };
return (
@@ -68,7 +72,18 @@ export default function DxcQuickNav({ links, title }: QuickNavTypes) {
{links.map((link) => (