livewire / flux

The official Livewire UI component library
https://fluxui.dev
475 stars 41 forks source link

Issue with `sr-only` Class on Custom File Input Causing Template Interactions #605

Closed beneyraheem closed 6 days ago

beneyraheem commented 1 week ago

When using the custom file input component with the class="sr-only", the template experiences unexpected behavior when interacting with ID links. Specifically, clicking on certain elements within the template does not trigger the expected actions. However, when theclass is changed to hidden, the issue resolves itself.

   <input
        x-ref="input"
        x-on:click.stop {{-- Without this, the parent element's click listener will ".prevent" the file input from being clicked... --}}
        type="file"
        class="sr-only"
        tabindex="-1"
        {{ $attributes }} {{ $multiple ? 'multiple' : '' }} {{ $name ? 'name="'.$name.'"' : '' }}
    >

Potential Workaround: Changing sr-only to hidden resolves the issue.

calebporzio commented 6 days ago

Hi there, can you please re-submit this issue with a copy/pastable code snippet I can use to reproduce the issue you are facing? Otherwise, I can't really understand and therefore help. Thanks