Skip to content

Commit

Permalink
Update room card navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
harmonie-durrant committed Jan 13, 2025
1 parent 84539da commit 3bef2d0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/cards/room-card/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ export class HHARoomCard extends HTMLElement {

_navigate() {
if (this._config && this._config.redirect) {
if (this._config.redirect.startsWith('#')) {
const element = document.querySelector(this._config.redirect);
if (element)
element.scrollIntoView({ behavior: 'smooth' });
return;
}
window.history.pushState({}, '', this._config.redirect);
this.dispatchEvent(new CustomEvent('location-changed', { bubbles: true, composed: true, detail: { path: this._config.redirect } }));
window.location.href = this._config.redirect;
}
}
Expand Down

0 comments on commit 3bef2d0

Please sign in to comment.