diff --git a/CHANGELOG.md b/CHANGELOG.md index 7696d5e2b1..6185c2e95f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -91,7 +91,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/ - Improved view code dialog UI in Fluent theme with better styling and accessibility, in PR [#5337](https://github.com/microsoft/BotFramework-WebChat/pull/5337), by [@OEvgeny](https://github.com/OEvgeny) - Switched math block syntax from `$$` to Tex-style `\[ \]` and `\( \)` delimiters with improved rendering and error handling, in PR [#5353](https://github.com/microsoft/BotFramework-WebChat/pull/5353), by [@OEvgeny](https://github.com/OEvgeny) - Improved avatar display and grouping behavior by fixing rendering issues and activity sender identification, in PR [#5346](https://github.com/microsoft/BotFramework-WebChat/pull/5346), by [@OEvgeny](https://github.com/OEvgeny) -- Activity "copy" button will use `outerHTML` and `textContent` for clipboard content, in PR [#5378](https://github.com/microsoft/BotFramework-WebChat/pull/5378), by [@compulim](https://github.com/compuilm) +- Activity "copy" button will use `outerHTML` and `textContent` for clipboard content, in PR [#5378](https://github.com/microsoft/BotFramework-WebChat/pull/5378), by [@compulim](https://github.com/compulim) ### Fixed @@ -108,6 +108,7 @@ Notes: web developers are advised to use [`~` (tilde range)](https://github.com/ - Fixed [#5350](https://github.com/microsoft/BotFramework-WebChat/issues/pull/5350). Bundled `shiki` in component package, in PR [#5349](https://github.com/microsoft/BotFramework-WebChat/pull5349), by [@compulim](https://github.com/compulim) - Fixed modal dialog rendering to prevent visual flicker and improve UX when opening code views, in PR [#5374](https://github.com/microsoft/BotFramework-WebChat/pull/5374), by [@OEvgeny](https://github.com/OEvgeny) - Fixed math parsing that could cause Web Chat to hang when processing certain LaTeX expressions, in PR [#5377](https://github.com/microsoft/BotFramework-WebChat/pull/5377), by [@OEvgeny](https://github.com/OEvgeny) +- Fixed long math formula should be scrollable, in PR [#5380](https://github.com/microsoft/BotFramework-WebChat/pull/5380), by [@compulim](https://github.com/compulim) # Removed diff --git a/__tests__/html2/markdown/math.html b/__tests__/html2/markdown/math/layout.1.html similarity index 100% rename from __tests__/html2/markdown/math.html rename to __tests__/html2/markdown/math/layout.1.html diff --git a/__tests__/html2/markdown/math.html.snap-1.png b/__tests__/html2/markdown/math/layout.1.html.snap-1.png similarity index 100% rename from __tests__/html2/markdown/math.html.snap-1.png rename to __tests__/html2/markdown/math/layout.1.html.snap-1.png diff --git a/__tests__/html2/markdown/math2.html b/__tests__/html2/markdown/math/layout.2.html similarity index 100% rename from __tests__/html2/markdown/math2.html rename to __tests__/html2/markdown/math/layout.2.html diff --git a/__tests__/html2/markdown/math2.html.snap-1.png b/__tests__/html2/markdown/math/layout.2.html.snap-1.png similarity index 100% rename from __tests__/html2/markdown/math2.html.snap-1.png rename to __tests__/html2/markdown/math/layout.2.html.snap-1.png diff --git a/__tests__/html2/markdown/math3.html b/__tests__/html2/markdown/math/layout.3.html similarity index 100% rename from __tests__/html2/markdown/math3.html rename to __tests__/html2/markdown/math/layout.3.html diff --git a/__tests__/html2/markdown/math/layout.3.html.snap-1.png b/__tests__/html2/markdown/math/layout.3.html.snap-1.png new file mode 100644 index 0000000000..2169ae0f07 Binary files /dev/null and b/__tests__/html2/markdown/math/layout.3.html.snap-1.png differ diff --git a/__tests__/html2/markdown/math/layout.3.html.snap-2.png b/__tests__/html2/markdown/math/layout.3.html.snap-2.png new file mode 100644 index 0000000000..7747b1bc58 Binary files /dev/null and b/__tests__/html2/markdown/math/layout.3.html.snap-2.png differ diff --git a/__tests__/html2/markdown/math/layout.3.html.snap-3.png b/__tests__/html2/markdown/math/layout.3.html.snap-3.png new file mode 100644 index 0000000000..efab592efa Binary files /dev/null and b/__tests__/html2/markdown/math/layout.3.html.snap-3.png differ diff --git a/__tests__/html2/markdown/math4.html b/__tests__/html2/markdown/math/layout.4.html similarity index 100% rename from __tests__/html2/markdown/math4.html rename to __tests__/html2/markdown/math/layout.4.html diff --git a/__tests__/html2/markdown/math4.html.snap-1.png b/__tests__/html2/markdown/math/layout.4.html.snap-1.png similarity index 100% rename from __tests__/html2/markdown/math4.html.snap-1.png rename to __tests__/html2/markdown/math/layout.4.html.snap-1.png diff --git a/__tests__/html2/markdown/math4.html.snap-2.png b/__tests__/html2/markdown/math/layout.4.html.snap-2.png similarity index 67% rename from __tests__/html2/markdown/math4.html.snap-2.png rename to __tests__/html2/markdown/math/layout.4.html.snap-2.png index 9ff584d13c..40f66e9161 100644 Binary files a/__tests__/html2/markdown/math4.html.snap-2.png and b/__tests__/html2/markdown/math/layout.4.html.snap-2.png differ diff --git a/__tests__/html2/markdown/math/layout.4.html.snap-3.png b/__tests__/html2/markdown/math/layout.4.html.snap-3.png new file mode 100644 index 0000000000..39afad3393 Binary files /dev/null and b/__tests__/html2/markdown/math/layout.4.html.snap-3.png differ diff --git a/__tests__/html2/markdown/math/layout.scroll.copilot.light.html b/__tests__/html2/markdown/math/layout.scroll.copilot.light.html new file mode 100644 index 0000000000..1f9d772773 --- /dev/null +++ b/__tests__/html2/markdown/math/layout.scroll.copilot.light.html @@ -0,0 +1,9 @@ + + + + + + + diff --git a/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-1.png b/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-1.png new file mode 100644 index 0000000000..c1d358f98b Binary files /dev/null and b/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-1.png differ diff --git a/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-2.png b/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-2.png new file mode 100644 index 0000000000..2bd8793767 Binary files /dev/null and b/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-2.png differ diff --git a/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-3.png b/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-3.png new file mode 100644 index 0000000000..a466b2b203 Binary files /dev/null and b/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-3.png differ diff --git a/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-4.png b/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-4.png new file mode 100644 index 0000000000..fa646b7dfd Binary files /dev/null and b/__tests__/html2/markdown/math/layout.scroll.copilot.light.html.snap-4.png differ diff --git a/__tests__/html2/markdown/math/layout.scroll.html b/__tests__/html2/markdown/math/layout.scroll.html new file mode 100644 index 0000000000..5ebc24b2b1 --- /dev/null +++ b/__tests__/html2/markdown/math/layout.scroll.html @@ -0,0 +1,121 @@ + + + + + + + + + + + + + +
+ + + diff --git a/__tests__/html2/markdown/math/layout.scroll.html.snap-1.png b/__tests__/html2/markdown/math/layout.scroll.html.snap-1.png new file mode 100644 index 0000000000..0f44c413b6 Binary files /dev/null and b/__tests__/html2/markdown/math/layout.scroll.html.snap-1.png differ diff --git a/__tests__/html2/markdown/math/layout.scroll.html.snap-2.png b/__tests__/html2/markdown/math/layout.scroll.html.snap-2.png new file mode 100644 index 0000000000..55260563c8 Binary files /dev/null and b/__tests__/html2/markdown/math/layout.scroll.html.snap-2.png differ diff --git a/__tests__/html2/markdown/math/layout.scroll.html.snap-3.png b/__tests__/html2/markdown/math/layout.scroll.html.snap-3.png new file mode 100644 index 0000000000..150378a617 Binary files /dev/null and b/__tests__/html2/markdown/math/layout.scroll.html.snap-3.png differ diff --git a/__tests__/html2/markdown/math/layout.scroll.html.snap-4.png b/__tests__/html2/markdown/math/layout.scroll.html.snap-4.png new file mode 100644 index 0000000000..cd31dca709 Binary files /dev/null and b/__tests__/html2/markdown/math/layout.scroll.html.snap-4.png differ diff --git a/__tests__/html2/markdown/math3.html.snap-1.png b/__tests__/html2/markdown/math3.html.snap-1.png deleted file mode 100644 index 31e802f8e3..0000000000 Binary files a/__tests__/html2/markdown/math3.html.snap-1.png and /dev/null differ diff --git a/__tests__/html2/markdown/math3.html.snap-2.png b/__tests__/html2/markdown/math3.html.snap-2.png deleted file mode 100644 index bf7c5b62ec..0000000000 Binary files a/__tests__/html2/markdown/math3.html.snap-2.png and /dev/null differ diff --git a/__tests__/html2/markdown/math3.html.snap-3.png b/__tests__/html2/markdown/math3.html.snap-3.png deleted file mode 100644 index 2af56c96b0..0000000000 Binary files a/__tests__/html2/markdown/math3.html.snap-3.png and /dev/null differ diff --git a/__tests__/html2/markdown/math4.html.snap-3.png b/__tests__/html2/markdown/math4.html.snap-3.png deleted file mode 100644 index 6734377968..0000000000 Binary files a/__tests__/html2/markdown/math4.html.snap-3.png and /dev/null differ diff --git a/packages/bundle/src/markdown/mathExtension/htmlRenderer.ts b/packages/bundle/src/markdown/mathExtension/htmlRenderer.ts index 71d10a1f92..324919aa2d 100644 --- a/packages/bundle/src/markdown/mathExtension/htmlRenderer.ts +++ b/packages/bundle/src/markdown/mathExtension/htmlRenderer.ts @@ -28,7 +28,8 @@ export default function createHtmlRenderer(options: CreateHtmlRendererOptions = type: 'block' | 'inline' | 'error' = defaults.type, tag: 'figure' | 'span' | 'pre' | 'code' = defaults.tag ) => { - this.tag(`<${tag} data-math-type="${type}">`); + // Math could be scrollable, need to be tabbable. + this.tag(`<${tag} data-math-type="${type}" tabindex="0">`); this.raw(content); this.tag(``); }; diff --git a/packages/component/src/Styles/StyleSet/RenderMarkdown.ts b/packages/component/src/Styles/StyleSet/RenderMarkdown.ts index 74aa8bba6a..870f254d05 100644 --- a/packages/component/src/Styles/StyleSet/RenderMarkdown.ts +++ b/packages/component/src/Styles/StyleSet/RenderMarkdown.ts @@ -67,18 +67,28 @@ export default function createMarkdownStyle() { content: "'['" }, - '& [data-math-type=block] math': { + '& [data-math-type=block]': { alignItems: 'center', display: 'flex', - flexDirection: 'column' + flexDirection: 'column', + marginBottom: '-4px', + paddingBottom: '4px', + outlineOffset: '2px', + overflowX: 'auto', + overflowY: 'clip', + scrollbarWidth: 'thin' }, - '& [data-math-type=inline] math': { + '& [data-math-type=inline]': { alignItems: 'center', display: 'inline-flex', flexDirection: 'column' }, + '& :is([data-math-type=block], [data-math-type=inline]) > span': { + display: 'contents' + }, + '& .webchat__render-markdown__code-block': { whiteSpace: 'pre-wrap' } diff --git a/packages/component/src/providers/HTMLContentTransformCOR/useTransformHTMLContent.ts b/packages/component/src/providers/HTMLContentTransformCOR/useTransformHTMLContent.ts index 74fff246be..29c9836ce0 100644 --- a/packages/component/src/providers/HTMLContentTransformCOR/useTransformHTMLContent.ts +++ b/packages/component/src/providers/HTMLContentTransformCOR/useTransformHTMLContent.ts @@ -21,7 +21,7 @@ const DEFAULT_ALLOWED_TAGS: ReadonlyMap