Skip to content

Commit 39ffa97

Browse files
authored
fix: make pause at end of page work with any translation (#579)
We were excluding sentences that had both class .translation and class .sentence__translation from the list of sentences to figure how which is the last sentence in a page, but we should exclude any sentence with either of those classes, or with do-no-align=true. Depending on how translations are added to a read-along, we don't always set both classes, so let's filter out anything that might be a translation when we are playing in the web-component. Fixes #578
1 parent 6901d6d commit 39ffa97

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • packages/web-component/src/components/read-along-component

packages/web-component/src/components/read-along-component/read-along.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,8 @@ export class ReadAlongComponent {
11251125
const sentences = paragraphs[
11261126
paragraphs.length - 1
11271127
].querySelectorAll(
1128-
"s:not(.translation), s:not(.sentence__translation)",
1128+
// chain the not statements so they are ANDed: exclude sentences matching any of these criteria
1129+
's:not(.translation):not(.sentence__translation):not([do-not-align="true"])',
11291130
); //get non-translation sentences in the last paragraph
11301131
const word =
11311132
sentences[sentences.length - 1].querySelector("w:last-of-type"); //get the last word of the last sentence

0 commit comments

Comments
 (0)