plotly / plotly/dash

[BUG] Upload component applying styles on Drag/Drop

Aperta
#3,376 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug
Lingua principale
Python
Stelle
24.4k
Fork
2.3k
Merge medio
2g 7h
PR unite (30g)
13

Descrizione

When using Drag/Drop to place files into an Upload component accepting only .obj or .XLS (seperate inputs for both filetypes) Edge display always the error border on the upload. Firefox diplaying the error broder when the obj File into the input with the accepting file Type .obj.

Describe your context
Running on Windows with Python 3.12

dash                      3.1.0
dash-bootstrap-components 2.0.3
  • if frontend related, tell us your Browser, Version and OS

    • OS: Windows
    • Browser: Edge / Firefox
    • Version: 138.0.3351.95 / 128.12.0esr

Describe the bug

Wrong colors on input borders when dropping Files with correct Filetype (obj / XLSX) setting on Edge always "red" for all input files and types. On Firefox only setting red border style for obj files.

Expected behavior

Show specified color in style_active attribute of input component


dcc.Upload(
    id=f"{id_str}-upload-data",
    children=html.Div(
        [
            "Drag und drop oder klicken um Datei für upload auszuwählen."
        ]
    ),
    style={
        "width": "100%",
        "height": "60px",
        "borderWidth": "2px",
        "borderStyle": "solid",
        "borderRadius": "5px",
        "borderColor": "var(--bs-primary-border-subtle)",
        "textAlign": "center",
    },
    multiple=False,
    accept=file_extension,
    className="align-content-center",
    style_active={
        "borderStyle": "solid",
        "borderColor": "var(--bs-success)",
    },
    style_reject={
        "borderStyle": "solid",
        "borderColor": "var(--bs-danger)",
    },
),

File type get set as "text/csv,application/vnd.ms-excel" for XLS inputs and .obj

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo dcc.Upload con le relative impostazioni accept, style, style_active e style_reject, quindi riproduci il comportamento di trascinamento e rilascio nelle versioni segnalate di Edge e Firefox. Il lavoro è completato quando i file .obj e XLS/XLSX validi trascinati e rilasciati mostrano lo stile attivo invece del bordo di rifiuto, mentre i file non validi continuano a mostrare lo stile di rifiuto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
frontend
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.