Skip to content

Commit

Permalink
feat: scrolls to top of page when highlighted word is brought into view
Browse files Browse the repository at this point in the history
  • Loading branch information
deltork committed Mar 28, 2024
1 parent 493a624 commit cdd079a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ export class ReadAlongComponent {
// scroll vertically (through paragraph) if needed
if (this.inPageContentOverflow(query_el)) {
if (this.autoScroll) {
query_el.scrollIntoView(false);
query_el.scrollIntoView({ block: "start", inline: "nearest" });
if (!this.isScrolling) this.scrollByHeight(query_el);
}
} // scroll horizontal (through paragraph) if needed
Expand Down
4 changes: 2 additions & 2 deletions packages/web-component/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<!-- put in your assets -->
<read-along
mode="EDIT"
href="http://localhost:5000/KSS-01A-MUS/KSS-01A-MUS.readalong"
audio="http://localhost:5000/KSS-01A-MUS/KSS-01A-MUS.mp3"
href="http://localhost:5000/ej-fra/ej-fra.readalong"
audio="http://localhost:5000/ej-fra/ej-fra.m4a"
language="en"
>
<span contentEditable="true" slot="read-along-header">Title</span>
Expand Down

0 comments on commit cdd079a

Please sign in to comment.