Skip to content

Commit 306acd3

Browse files
committed
fix: add dir=auto to table cells for RTL
1 parent 807309d commit 306acd3

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
@@ -132,11 +132,11 @@
132132
{/if}
133133
{:else if token.type === 'table'}
134134
<div class="relative w-full group mb-2">
135-
<div class="scrollbar-hidden relative overflow-x-auto max-w-full">
136-
<table
137-
class=" w-full text-sm text-start text-gray-500 dark:text-gray-400 max-w-full rounded-xl"
138-
dir="auto"
139-
>
135+
<div class="scrollbar-hidden relative overflow-x-auto max-w-full" dir="auto">
136+
<span class="sr-only" aria-hidden="true">{token.header[0]?.text || ''}</span>
137+
<table
138+
class=" w-full text-sm text-start text-gray-500 dark:text-gray-400 max-w-full rounded-xl"
139+
>
140140
<thead
141141
class="text-xs text-gray-700 uppercase bg-white dark:bg-gray-900 dark:text-gray-400 border-none"
142142
>
@@ -146,6 +146,7 @@
146146
scope="col"
147147
class="px-2.5! py-2! cursor-pointer border-b border-gray-100! dark:border-gray-800!"
148148
style={token.align[headerIdx] ? `text-align: ${token.align[headerIdx]}` : ''}
149+
dir="auto"
149150
>
150151
<div class="gap-1.5 text-start">
151152
<div class="shrink-0 break-normal">
@@ -173,8 +174,9 @@
173174
? ''
174175
: 'border-b border-gray-50! dark:border-gray-850!'}"
175176
style={token.align[cellIdx] ? `text-align: ${token.align[cellIdx]}` : ''}
177+
dir="auto"
176178
>
177-
<div class="break-normal">
179+
<div class="break-normal text-start">
178180
<MarkdownInlineTokens
179181
id={`${id}-${tokenIdx}-row-${rowIdx}-${cellIdx}`}
180182
tokens={cell.tokens}

0 commit comments

Comments
 (0)