Skip to content
Snippets Groups Projects
Commit 412dafd1 authored by shamalainen's avatar shamalainen
Browse files

Create functionality to link to tab element

parent f085e6e9
No related branches found
No related tags found
No related merge requests found
......@@ -316,6 +316,16 @@ export class HyTabs implements ComponentInterface {
const classComponentAttributes = ['hy-tabs__container', `hy-tabs__container__${this.headerstyle}`].join(' ');
const id = this.tabId.toLowerCase().replace(/\W/g, '-');
if (window.location.hash) {
const tabHash = window.location.hash.substring(1);
const isUrlHashed = this.tabButtonTitles.some((tab) => tab['id'] === tabHash);
if (isUrlHashed) {
const hashElement = document.getElementById(tabHash);
if (hashElement) this.activateTab(hashElement, true);
}
}
return [
<hy-box pt="1.25, 1.25, 1.5, 2.5" />,
<div id={id} class={classComponentAttributes}>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment