Skip to content

Commit 110d9d1

Browse files
Algorithm5838github-actions[bot]
authored andcommitted
fix: add dir=auto to table cells for RTL
1 parent 4b34fc2 commit 110d9d1

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
@@ -179,11 +179,11 @@
179179
{/if}
180180
{:else if token.type === 'table'}
181181
<div class="relative w-full group mb-2">
182-
<div class="scrollbar-hidden relative overflow-x-auto max-w-full">
183-
<table
184-
class=" w-full text-sm text-start text-gray-500 dark:text-gray-400 max-w-full rounded-xl"
185-
dir="auto"
186-
>
182+
<div class="scrollbar-hidden relative overflow-x-auto max-w-full" dir="auto">
183+
<span class="sr-only" aria-hidden="true">{token.header[0]?.text || ''}</span>
184+
<table
185+
class=" w-full text-sm text-start text-gray-500 dark:text-gray-400 max-w-full rounded-xl"
186+
>
187187
<thead
188188
class="text-xs text-gray-700 uppercase bg-white dark:bg-gray-900 dark:text-gray-400 border-none"
189189
>
@@ -193,6 +193,7 @@
193193
scope="col"
194194
class="px-2.5! py-2! cursor-pointer border-b border-gray-100! dark:border-gray-800!"
195195
style={token.align[headerIdx] ? `text-align: ${token.align[headerIdx]}` : ''}
196+
dir="auto"
196197
>
197198
<div class="gap-1.5 text-start">
198199
<div class="shrink-0 break-normal">
@@ -220,8 +221,9 @@
220221
? ''
221222
: 'border-b border-gray-50! dark:border-gray-850!'}"
222223
style={token.align[cellIdx] ? `text-align: ${token.align[cellIdx]}` : ''}
224+
dir="auto"
223225
>
224-
<div class="break-normal">
226+
<div class="break-normal text-start">
225227
<MarkdownInlineTokens
226228
id={`${id}-${tokenIdx}-row-${rowIdx}-${cellIdx}`}
227229
tokens={cell.tokens}

0 commit comments

Comments
 (0)