Skip to content

Commit

Permalink
scroll results into view when loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomEtc committed Oct 1, 2023
1 parent 55a965d commit 618c7ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/state-calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,16 @@ export class RewiringAmericaStateCalculator extends LitElement {
},
});

override updated() {
if (
this._utilitiesTask.status === TaskStatus.COMPLETE &&
this._task.status === TaskStatus.COMPLETE
) {
const results = this.shadowRoot?.querySelector('#at-a-glance');
results?.scrollIntoView({ behavior: 'smooth' });
}
}

override render() {
// If we have incentives loaded, use coverage.state from that to determine
// which state outline to show. Otherwise, look at the "tempState" override,
Expand Down
2 changes: 1 addition & 1 deletion src/state-incentive-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ const summaryBoxTemplate = (

const atAGlanceTemplate = (response: APIResponse) => {
return html`
<div class="grid-section">
<div class="grid-section" id="at-a-glance">
<h2 class="grid-section__header">Incentives at a glance</h2>
<div class="grid-4-2-1 grid-4-2-1--align-start">
${summaryBoxTemplate(
Expand Down

0 comments on commit 618c7ce

Please sign in to comment.