vnphanquang / svelte-put

Useful svelte stuff to put in your projects
https://svelte-put.vnphanquang.com
MIT License
837 stars 25 forks source link

Modal.svelte contains svelte a11y warning #268

Closed BCsabaEngine closed 10 months ago

BCsabaEngine commented 10 months ago

svelte 4 build occurs a warning when build

Current code in Modal.svelte:

<slot name="backdrop" class={rClasses.backdrop} onClick={onClickBackdrop}>
  {#if backdrop}
    <!-- svelte-ignore a11y-click-events-have-key-events -->
    <div class={rClasses.backdrop} on:click={onClickBackdrop} transition:fade={{ duration: 75 }} />
  {/if}
</slot>

Necessary code:

<slot name="backdrop" class={rClasses.backdrop} onClick={onClickBackdrop}>
  {#if backdrop}
    <!-- svelte-ignore a11y-click-events-have-key-events -->
    <!-- svelte-ignore a11y-no-static-element-interactions -->
    <div class={rClasses.backdrop} on:click={onClickBackdrop} transition:fade={{ duration: 75 }} />
  {/if}
</slot>

I have solved with patch-package while not solved by owner.

BCsabaEngine commented 10 months ago

diff

diff --git a/node_modules/@svelte-put/modal/dist/Modal.svelte b/node_modules/@svelte-put/modal/dist/Modal.svelte
index 8c53df6..78a9bfc 100644
--- a/node_modules/@svelte-put/modal/dist/Modal.svelte
+++ b/node_modules/@svelte-put/modal/dist/Modal.svelte
@@ -82,6 +82,7 @@ function onPressEscape() {
 <slot name="backdrop" class={rClasses.backdrop} onClick={onClickBackdrop}>
   {#if backdrop}
     <!-- svelte-ignore a11y-click-events-have-key-events -->
+    <!-- svelte-ignore a11y-no-static-element-interactions -->
     <div class={rClasses.backdrop} on:click={onClickBackdrop} transition:fade={{ duration: 75 }} />
   {/if}
 </slot>
vnphanquang commented 10 months ago

Hey thanks again for reporting. I will see what I can do. I'm a bit occupied at the moment with work so apologies in advance if things might seem a bit slow here.

vnphanquang commented 10 months ago

Should be resolved in @svelte-put/modal@1.0.6. Thank you!