Skip to content

Commit dadd86a

Browse files
committed
fix: add dir=auto to table cells for RTL
1 parent d6793e8 commit dadd86a

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/lib/components/chat/Messages/Markdown/MarkdownTokens.svelte

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@
180180
{/if}
181181
{:else if token.type === 'table'}
182182
<div class="relative w-full group mb-2">
183-
<div class="scrollbar-hidden relative overflow-x-auto max-w-full">
184-
<table
185-
class=" w-full text-sm text-start text-gray-500 dark:text-gray-400 max-w-full rounded-xl"
186-
dir="auto"
187-
>
183+
<div class="scrollbar-hidden relative overflow-x-auto max-w-full" dir="auto">
184+
<span class="sr-only" aria-hidden="true">{token.header[0]?.text || ''}</span>
185+
<table
186+
class=" w-full text-sm text-start text-gray-500 dark:text-gray-400 max-w-full rounded-xl"
187+
>
188188
<thead
189189
class="text-xs text-gray-700 uppercase bg-white dark:bg-gray-900 dark:text-gray-400 border-none"
190190
>
@@ -194,6 +194,7 @@
194194
scope="col"
195195
class="px-2.5! py-2! cursor-pointer border-b border-gray-100! dark:border-gray-800!"
196196
style={token.align[headerIdx] ? `text-align: ${token.align[headerIdx]}` : ''}
197+
dir="auto"
197198
>
198199
<div class="gap-1.5 text-start">
199200
<div class="shrink-0 break-normal">
@@ -221,8 +222,9 @@
221222
? ''
222223
: 'border-b border-gray-50! dark:border-gray-850!'}"
223224
style={token.align[cellIdx] ? `text-align: ${token.align[cellIdx]}` : ''}
225+
dir="auto"
224226
>
225-
<div class="break-normal">
227+
<div class="break-normal text-start">
226228
<MarkdownInlineTokens
227229
id={`${id}-${tokenIdx}-row-${rowIdx}-${cellIdx}`}
228230
tokens={cell.tokens}

0 commit comments

Comments
 (0)