Skip to content

Commit

Permalink
fix(screen-reader): disable FileDropZone area-label for models withou…
Browse files Browse the repository at this point in the history
…t file upload (huggingface#1295)

Co-authored-by: Nathan Sarrazin <sarrazin.nathan@gmail.com>
  • Loading branch information
neven4 and nsarrazin authored Jun 20, 2024
1 parent 8d29e60 commit eb4c2ad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/lib/components/chat/ChatWindow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
: []),
...(currentModel.multimodal ? ["image/*"] : []),
];
$: isFileUploadEnabled = activeMimeTypes.length > 0;
</script>

<div class="relative min-h-0 min-w-0">
Expand Down Expand Up @@ -312,7 +314,7 @@
/>
{:else}
<div class="ml-auto gap-2">
{#if activeMimeTypes.length > 0}
{#if isFileUploadEnabled}
<UploadBtn bind:files mimeTypes={activeMimeTypes} classNames="ml-auto" />
{/if}
{#if messages && lastMessage && lastMessage.interrupted && !isReadOnly}
Expand All @@ -334,12 +336,12 @@
on:dragenter={onDragEnter}
on:dragleave={onDragLeave}
tabindex="-1"
aria-label="file dropzone"
aria-label={isFileUploadEnabled ? "file dropzone" : undefined}
on:submit|preventDefault={handleSubmit}
class="relative flex w-full max-w-4xl flex-1 items-center rounded-xl border bg-gray-100 focus-within:border-gray-300 dark:border-gray-600 dark:bg-gray-700 dark:focus-within:border-gray-500
{isReadOnly ? 'opacity-30' : ''}"
>
{#if onDrag && activeMimeTypes.length > 0}
{#if onDrag && isFileUploadEnabled}
<FileDropzone bind:files bind:onDrag mimeTypes={activeMimeTypes} />
{:else}
<div class="flex w-full flex-1 border-none bg-transparent">
Expand Down

0 comments on commit eb4c2ad

Please sign in to comment.