Skip to content

Commit d2c0059

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

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

0 commit comments

Comments
 (0)