adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
726 stars 735 forks source link

JS error from Tabs.js when using React Router #1661

Open ahumphreys87 opened 3 years ago

ahumphreys87 commented 3 years ago

Bug Report

Current Behavior In SPA applications that use React Router, it will append a #/ to the hash router. This is causing: https://github.com/adobe/aem-core-wcm-components/blob/master/content/src/content/jcr_root/apps/core/wcm/components/tabs/v1/tabs/clientlibs/site/js/tabs.js#L328 to throw a JS error.

Expected behavior/code No JS error should appear when using the react hash router.

Environment

Possible Solution Updating https://github.com/adobe/aem-core-wcm-components/blob/master/content/src/content/jcr_root/apps/core/wcm/components/tabs/v1/tabs/clientlibs/site/js/tabs.js#L326 to if (location.hash && location.hash !== "#" && location.hash !== "#/") {

Additional context / Screenshots n/a

ahumphreys87 commented 2 years ago

@richardhand just wondering if you think my fix here would be ok? Im happy to open a PR for it if so