JUSTICE BUSBY delivered the opinion of the Court. Justice Young did not participate in the decision. Rarely is the right to be heard by a jury in competition with the right to be heard at all. Yet Section 153.009(a) of the Family Code puts this choice to litigants. Under this statute, parents in a divorce or custody proceeding may request either a jury trial or an interview of their children by the judge—but not both. The question here is what should happen when a parent trades one right for the other and receives neither. In this divorce proceeding, a mother withdrew her jury demand for the stated purpose of invoking the trial court’s statutory obligation to interview her thirteen-year-old daughter regarding which parent she would prefer to have determine her primary residence. The trial court did not conduct the interview and ultimately granted the father the exclusive right to determine the primary residence of the couple’s four children. We hold that (1) the trial court erred in failing to conduct the interview, (2) such an error is subject to a harm analysis, (3) this error was harmful because it resulted in the loss of a jury trial on disputed fact questions, and (4) the mother is entitled to her requested remedy that the trial court comply with Section 153.009(a).We therefore reverse the judgment in part and remand for an interview under Section 153.009(a) followed by a new judgment regarding the child’s primary residence. BACKGROUND In 2017, J.H.N. (Father) filed for divorce from M.A.N. (Mother). The case proceeded to trial on various disputed issues in May 2019, including which parent would have the exclusive right to determine the primary residence of the couple’s four children. At that time, the eldest child—their daughter, M.N.—was thirteen years old. The Family Code provides that upon application by certain parties, a trial court “may interview in chambers” any child and “shall interview . . . a child 12 years of age or older” to “determine the child’s wishes as to . . . who shall have the exclusive right to determine the child’s primary residence.” TEX. FAM. CODE § 153.009(a). This statute applies only to nonjury trials or hearings. Id. Therefore, a litigant must forgo her right to a jury trial to benefit from Section 153.009(a)’s interview provision. More than a year before trial, Father filed a motion requesting that the court interview the children. Mother demanded a jury trial and paid the jury fee, rendering Father’s request inapplicable. But Mother withdrew her jury demand at the pretrial conference. Mother’s counsel explained, and Mother later testified, that she did so to take advantage of Section 153.009(a)’s mandate that the trial court interview M.N. Following the pretrial conference, Mother’s counsel emailed a letter to the trial court coordinator asking that she “[p]lease accept this letter as my formal written request to schedule [M.N.], a child subject to this suit over the age of 12, to confer with the Judge in chambers in accordance with” Section 153.009(a) and the court’s posted policies and procedures. The court’s policy was to schedule in-chambers interviews in advance and conduct them after other testimony was complete. Mother’s counsel called the coordinator nearly twenty times in an effort to schedule the interview. At trial, Mother’s counsel again requested that the court interview M.N. and explained that Mother withdrew her jury-trial demand solely for that purpose. The court declined to conduct the interview on the ground that Mother had not filed a written motion. Immediately after trial, Mother filed a “Brief in Support of Texas Family Code § 153.009: Interview with a Child in Chambers,” which included a representation that M.N. preferred to reside with Mother. Several weeks later, she filed a “Motion for Judge to Confer with Children and Joinder of Petitioner’s Motion to Confer.” The trial court did not rule on these filings or interview M.N. Nearly a year later, the court issued the final divorce decree. Mother and Father were appointed joint managing conservators of the children, and Father was granted the exclusive right to determine the children’s primary residence. The court of appeals affirmed in a split decision. 663 S.W.3d 240, 248 (Tex. App.—Dallas 2022). The panel unanimously held that the trial court erred in failing to conduct an in-chambers interview because Section 153.009(a)’s interview requirement is mandatory but disagreed about whether the error was subject to a harm analysis. Compare id. at 248, with id. at 249 (Carlyle, J., dissenting). The majority held that a harm analysis applied to the trial court’s error and that it was harmless because interviewing the child “does not diminish the discretion of the trial court in determining the best interests of the child.” Id. at 248 (quoting TEX. FAM. CODE § 153.009(c)).Thus, “even if M.N. had expressed a preference to live with Mother,” the trial court “would not have been obligated to make a different conservatorship decision.” Id. The dissenting justice contended that a harm analysis should not apply to violations of Section 153.009(a)’s interview requirement. Id. at 249-250 (Carlyle, J., dissenting). And, if a harm analysis did apply, the error was harmful because the trial court’s refusal to hear from the child “probably prevented the appellant from properly presenting the case to the court of appeals.” Id. at 251 (citing TEX. R. APP. P. 44.1(a)(2)).[1] We granted review. ANALYSIS The trial court erred by declining to interview the child. We begin by considering whether the trial court’s decision not to interview M.N. was error. In a suit affecting the parent-child relationship, Section 153.009 of the Family Code generally provides that a trial court conducting a nonjury trial or hearing “may” interview a child in chambers to determine the child’s wishes on issues of possession, access, conservatorship, and right to determine primary residence.[2] But when the child is “12 years of age or older,” then “on the application of a party, the amicus attorney, or the attorney ad litem for the child, the court shall interview” the child “to determine the child’s wishes as to conservatorship or as to the person who shall have the exclusive right to determine the child’s primary residence.” TEX. FAM. CODE § 153.009(a) (emphasis added). The record shows that each element of this statutory directive was satisfied here. M.N. was older than twelve, her mother timely applied for the court to interview her in chambers, and there was no dispute that she was able to express her wishes.[3] Thus, the court had a duty to interview her in chambers, and it erred by declining to do so. See TEX. GOV’T CODE § 311.016(2) (“‘Shall’ imposes a duty.”). The trial court declined to conduct the interview because Mother had not filed a written motion before trial, but we agree with the court of appeals that the statute does not require a written motion to be filed. 663 S.W.3d at 247. The record shows that Mother: emailed a letter to the court coordinator prior to trial requesting an interview “in accordance with Sec. 153.009(a) of the Texas Family Code”; called the court nearly twenty times to schedule the interview; reiterated her request at trial; and submitted two written requests after trial, one of which included a representation that M.N. preferred to reside with her. Because Mother made the court aware of her application to interview M.N. in chambers at a time when the court could have acted on it, the court erred by declining to conduct the interview. An analysis of the harm caused by the error is required. As a general rule, “[n]o [civil] judgment may be reversed on appeal on the ground that the trial court made an error of law unless” that error was harmful. TEX. R. APP. P. 44.1(a), 61.1. Mother argues that harm analysis is inapplicable here. We conclude, however, that a trial court’s violation of Section 153.009(a)’s interview mandate does not fall within any of the recognized exceptions to the harm requirement. The mandatory nature of a statute does not foreclose a harm analysis. In re D.I.B.,988 S.W.2d 753, 757-59 (Tex. 1999). The exclusion of evidence is also generally subject to a harm analysis, see, e.g., State v. Cent. Expressway Sign Assocs., 302 S.W.3d 866, 870 (Tex. 2009), as is the erroneous denial of a civil jury trial, see, e.g., Halsell v. Dehoyos, 810 S.W.2d 371, 372 (Tex. 1991). On the other hand, there are some structural errors in the constitution of the trial mechanism itself that defy meaningful analysis by harmless-error standards. In re K.R., 63 S.W.3d 796, 799-800 (Tex. 2001). Typically, these errors involve denials of constitutional rights basic to fair criminal trials, such as the deprivation of counsel, the denial of a public trial, or the refusal to honor a defendant’s right of self-representation. See id. at 800. And “[i]n some instances,” such as a trial before a disqualified judge or unremedied discrimination in jury selection, “the harm flowing from a trial court’s [structural] error in a civil or [juvenile] case may be apparent from the nature of the error and the particular facts.” In re D.I.B., 988 S.W.2d at 759; see, e.g., United Rentals N. Am., Inc. v. Evans, ___ S.W.3d ___, 2023 WL 3398566, at *5-7 (Tex. May 12, 2023) (purposeful race discrimination in jury selection not remedied by trial court); In re Union Pac. Res. Co., 969 S.W.2d 427, 428 (Tex. 1998) (disqualified judge). Excluding M.N.’s testimony was not a structural error of this sort; it was an error in the trial process that violated a statute. Therefore, we must consider whether the error was harmful under Rule 61.1. The error probably caused the rendition of an improper judgment. An error warrants reversal when it either “(a) probably caused the rendition of an improper judgment; or (b) probably prevented the petitioner from properly presenting the case to the appellate courts.” TEX. R. APP. P. 61.1. This harm analysis requires a reviewing court to evaluate the impact of the error on the trial court’s final judgment or the judgment’s review by an appellate court. When a trial court fails to interview a child under Section 153.009(a), the relevant consequence of the error generally will be the improper exclusion of the child’s testimony, and a reviewing court will analyze the potential influence of that testimony on the judgment under Rule 44.1(a)(1) or 61.1(a).See, e.g., Cent. Expressway Sign Assocs., 302 S.W.3d at 870; Interstate Northborough P’ship v. State, 66 S.W.3d 213, 220 (Tex.2001). In this case, however, the trial court’s error had two relevant consequences: (1) it incorrectly excluded M.N.’s testimony, and (2) it caused Mother to give up her right to a jury based on a false premise. As we find the latter dispositive, we begin our analysis there. When a trial court errs, the error’s consequences may ripple beyond its effect on the proceedings at the moment the error is committed. The error may also retroactively undermine decisions made before trial in reliance on the trial court not erring. Specifically, we have recognized that when a trial court’s error causes a litigant to select a factfinder based on a false premise, a reviewing court should determine whether the error was harmful by looking at what the litigant gave up in reliance on the trial court following the law. In In re D.I.B., for example, a juvenile defendant opted for a jury trial after the trial court erroneously informed her that it lacked the authority to grant probation. 988 S.W.2d at 760. In reliance on the court’s statement, the defendant gave up her preferred factfinder—a judge—so that she could seek probation. Id. As (1) the defendant was entitled to rely on the trial court to state the law correctly; (2) the trial court erred in doing so; and (3) the defendant gave up her preferred factfinder based on the false premise that the court’s statement was correct, the harm analysis focused on the litigant’s loss of a bench trial. Id. Similarly, in Mercedes-Benz Credit Corp. v. Rhyne, we considered the harm of a trial court’s decision to deny a jury trial to a litigant who had relied on the court’s order setting the case on the jury docket. 925 S.W.2d 664, 665 (Tex. 1996). The trial court set the case on the jury docket and issued an order announcing it had done so. Id. In reliance on the trial court following its order, the petitioner did not pay the jury fee more than thirty days before trial. Id. at 666; see TEX.R.CIV.P. 216. But, as in In re D.I.B., the petitioner’s reliance, while reasonable, was misplaced. The trial court disregarded its order, denied the petitioner’s request for a jury trial due to the untimely payment, and proceeded with a bench trial. Rhyne, 925 S.W.2d at 665-66. Again, (1) the litigant was entitled to rely on the trial court to follow its order, see id. at 666; (2) the trial court abused its discretion in failing to do so, see id.; and (3) the litigant did not take further action to secure its preferred factfinder based on the premise that the court would follow its order, see id., which proved to be false. Therefore, the harm analysis focused on what the petitioner lost in reliance on the trial court following its order: a jury trial. Id. The unique circumstances found in In re D.I.B. and Rhyne are also present here. First, Mother was entitled to rely on the trial court to follow the statutory mandate of Section 153.009(a) and interview M.N. As discussed above, all requirements for an interview were met here. In this situation, a party is entitled to rely on the court to follow the legislative mandate, just as the court’s policy indicated it would. Second, the trial court erred by declining to interview M.N. as the statute required. Third, in reliance on the trial court following the statute and its policy, Mother gave up her preferred factfinder—a jury—so that she could have M.N. interviewed by the court. This circumstance is present when the record shows that but for the interview request, the parent would have pursued a jury trial. A jury demand and payment of the jury fee followed by an express waiver of a jury is sufficient, but it is not necessary. A parent may also make clear in writing or on the record that her reason for not demanding a jury or for withdrawing a prior demand was to have the trial court interview the child. The record here shows that Mother had requested, paid for, and was therefore constitutionally entitled to a jury trial. See TEX. CONST. art. V, § 10. After securing this right, Mother stated—repeatedly—that she gave up the right only to benefit from Section 153.009(a)’s mandatory interview provision. See TEX. FAM. CODE § 153.009(a) (mandating interviews only in certain nonjury trials or hearings). But the premise that the court would follow the statute and its policy if she gave up her right to a jury trial proved to be false. Under these circumstances, the proper focus of the harm analysis is on what Mother gave up in reliance on the trial court following the law: a jury trial.[4] We have concluded that when a trial court’s error causes a party to lose her right to present her case to a jury, that error is harmful if there were material fact issues for a jury to resolve. See In re Prudential Ins. Co., 148 S.W.3d 124, 138-39 (Tex. 2004); Rhyne, 925 S.W.2d at 667; Halsell, 810 S.W.2d at 372. This holding not only recognizes the gravity of improperly foreclosing a litigant’s opportunity to be heard by a jury of their peers[5] but also aligns with Rule 61.1(a)’s approach to harmful-error analysis. Under that part of the rule, an error is harmful when it “probably causes the rendition of an improper judgment.” TEX. R. APP. P. 61.1(a).When the wrong decisionmaker makes factual determinations, the resulting judgment is improper. Therefore, when a suit involves material disputes of fact that are erroneously resolved by the court rather than a jury, the judgment is improper and reversal appropriate. Here, material fact issues exist. A primary issue in this case— the determination of which joint managing conservator has the exclusive right to designate the primary residence of M.N.—is a matter appropriate for resolution by a jury. See TEX. FAM. CODE § 105.002. Relevant to this determination are several subsidiary fact issues, including what joint managing conservatorship arrangement is in the best interest of M.N. and M.N.’s preferences regarding conservatorship. See Holley v. Adams, 544 S.W.2d 367,371-72 (Tex.1976) (listing “desires of the child” as first factor in best-interest determination). Because selecting which parent will designate M.N.’s primary residence involves factual disputes that Mother would have been entitled to have a jury resolve, Mother’s loss of that opportunity was harmful. See In re Prudential Ins. Co., 148 S.W.3d at 138-39; Rhyne, 925 S.W.2d at 667; Halsell, 810 S.W.2d at 372. Mother is entitled to a partial reversal and remand for an interview. Having concluded that the trial court’s error was harmful under Rule 61.1(a), we now turn to the appropriate remedy for that error. Given the time-sensitive nature of determinations involving the parent-child relationship, we note that a court of appeals receiving a case like this one may wish to determine at the outset whether an interview was required. If so, the court could abate the appeal and remand for the trial court to conduct the interview and (if necessary) amend its judgment. In other cases, circumstances may have materially and substantially changed during the pendency of the appeal, requiring a new trial. See, e.g., TEX.FAM. CODE § 156.101(a). In this case, Mother requested only that this Court reverse and remand the case to the trial court for compliance with Section 153.009(a). We therefore reverse the portion of the judgment giving Father the exclusive right to designate M.N.’s primary residence, and we remand for the trial court to conduct the interview and issue an amended judgment on the primary residence issue.[6] CONCLUSION Section 153.009(a) imposed a mandatory obligation on the trial court to interview M.N., and it erred by declining to do so. As Mother gave up her right to a jury trial based on the false premise that the interview would occur and the case involves disputed fact issues, this error resulted in the rendition of an improper judgment under Rule 61.1(a). Consequently, we reverse the portion of the court of appeals’ judgment affirming the trial court’s judgment giving Father the exclusive right to designate M.N.’s primary residence. We remand the case for the trial court to interview M.N. under Section 153.009(a) and issue an amended judgment regarding which parent has the right to designate M.N.’s primary residence, as well as any other proceedings necessary to that judgment. J. Brett Busby Justice OPINION DELIVERED: June 9, 2023