Repository navigation
fix(web): tab to equations only when they overflow #23954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
maria-rcks
merged 6 commits into
pingdotgg:main
from
only21mil:r13/b154-only-make-overflowing-equations-keyboard
Oct 30, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
86ad146
test(web): cover keyboard access as equations grow
only21mil bb5b451
fix(web): tab to equations only when they overflow
only21mil 5e1874c
test(web): keep the equation fixture inside the viewport
only21mil 94419f7
test(web): use the default equation fixture layout
only21mil ba52c44
chore: merge main
maria-rcks 38c2b09
fix(web): explain equation resize observer state synchronization
maria-rcks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
apps/web/src/components/chat/MarkdownMath.browser.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { expect, it } from "vite-plus/test"; | ||
| import { userEvent } from "vite-plus/test/browser"; | ||
|
|
||
| import { render } from "../../../test/render"; | ||
| import "../../index.css"; | ||
|
|
||
| import { MarkdownMath } from "./MarkdownMath"; | ||
|
|
||
| it("keeps keyboard scrolling available as a streamed equation outgrows its viewport", async () => { | ||
| const equation = (tex: string, width = 180) => ( | ||
| <div style={{ width }}> | ||
| <button>Before equation</button> | ||
| <MarkdownMath tex={tex} display /> | ||
| <button>After equation</button> | ||
| </div> | ||
| ); | ||
| await using screen = await render(equation("x")); | ||
| await screen.getByRole("button", { name: "Before equation" }).click(); | ||
| await userEvent.keyboard("{Tab}"); | ||
| await expect.element(screen.getByRole("button", { name: "After equation" })).toHaveFocus(); | ||
|
|
||
| await screen.rerender(equation("x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8")); | ||
| const scroller = screen.getByLabelText("Scroll display equation"); | ||
| await expect.element(scroller).toHaveAttribute("tabindex", "0"); | ||
| await screen.getByRole("button", { name: "Before equation" }).click(); | ||
| await userEvent.keyboard("{Tab}"); | ||
| await expect.element(scroller).toHaveFocus(); | ||
| await userEvent.keyboard("{ArrowRight}"); | ||
| await expect.element(scroller).not.toHaveProperty("scrollLeft", 0); | ||
|
|
||
| await screen.rerender(equation("x_1 + x_2 + x_3 + x_4 + x_5 + x_6 + x_7 + x_8", 1000)); | ||
| await expect.element(screen.getByLabelText("Scroll display equation")).not.toBeInTheDocument(); | ||
| await screen.getByRole("button", { name: "Before equation" }).click(); | ||
| await userEvent.keyboard("{Tab}"); | ||
| await expect.element(screen.getByRole("button", { name: "After equation" })).toHaveFocus(); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: pingdotgg/t3code
Length of output: 13486
Script executed:
Repository: pingdotgg/t3code
Length of output: 23627
Web query:
KaTeX v0.16.47 mathrlap source lap.js absolute positioned child scrollWidth ResizeObserver content-box behaviorResult:
Web query:
KaTeX v0.16.47 raw src/functions/lap.js mathrlap rlap innerResult:
Web query:
CSS overflow scrollable overflow area absolutely positioned descendants scrollWidth specificationResult:
Web query:
site:raw.githubusercontent.com/KaTeX/KaTeX/v0.16.47/src/functions/lap.js mathrlapResult:
Script executed:
Repository: pingdotgg/t3code
Length of output: 940
Script executed:
Repository: pingdotgg/t3code
Length of output: 2787
Remeasure when
props.texchanges.KaTeX renders
\mathrlapas a zero-width.rlapwith an absolutely positioned.inner. The inner content can increasescrollWidthwithout changing the observedviewportorcontentboxes. Because this effect does not depend onprops.tex, the scroller can remain attabIndex="-1"after a TeX update.Suggested fix
Committable suggestion