bar-tabs: :tooltip-fn is called with the tab id, not the tab
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 70/100
Direzione di ricerca
Leggi src/re_com/bar_tabs.cljs righe 110-113, dove tooltip-part chiama (tooltip-fn id), e confronta con la versione v2.25.4 in src/re_com/tabs.cljs che passava la map del tab; controlla anche l'args-desc intorno alla riga 45 e come vengono chiamate id-fn/label-fn nello stesso ciclo. Scrivi prima il test che fallisce in test/re_com/bar_tabs_test.cljs, modellato su test/re_com/checkbox_test.cljs, che renderizza horizontal-bar-tabs con :tooltip-fn :hint e verifica che la parte tooltip porti il :hint del tab. Fatto sembra che la tooltip-fn riceva la map del tab e che quel test passi, ma conferma con un maintainer che questa è una regressione prima di applicare la patch.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
This is a suggested regression. We found it by reading the code during an audit of the :parts and :theme migration (#352). It was not reported from an app. It needs looking over before anyone decides whether it is a regression or an intended change.
What changed
Before, :tooltip-fn was called with the tab map.
See src/re_com/tabs.cljs line 134 at v2.25.4:
tooltip (when tooltip-fn (tooltip-fn t))
Now it is called with the tab id.
See src/re_com/bar_tabs.cljs lines 110 to 113 at 66162a21:
tooltip-part (or (:tooltip t)
(when tooltip-fn (tooltip-fn id))
(-> props :parts :tooltip-label))
The change arrived with the tabs migration (4f48f8d6, first released in v2.26.1).
Why we think it's a regression
- The args-desc still gives the type as
tab -> string | hiccupand says "given an element of:tabs, returns its tooltip" (bar_tabs.cljsline 45). - The documented default is still
:tooltip, which only makes sense when applied to a tab map. - The sibling functions
id-fnandlabel-fnare still called with the tab map in the same loop. - The 2.26.0 changelog does not mention a change to
:tooltip-fn.
The default case still works, because (:tooltip t) is tried first.
Only a caller-supplied :tooltip-fn is affected.
Who it affects
Callers that pass their own :tooltip-fn:
[rc/horizontal-bar-tabs
:model model
:tabs [{:id 1 :label "one" :hint "First"}]
:tooltip-fn :hint
:on-change f]
Before, the tooltip was "First".
Now (:hint 1) is nil, so no tooltip shows.
A function that reads keys from its argument fails in the same silent way.
Suggested fix
Call (tooltip-fn t).
The (:tooltip t) branch can then become the :or default tooltip-fn :tooltip, as at v2.25.4.
A failing test should come first, modelled on test/re_com/checkbox_test.cljs: render bar-tabs with :tooltip-fn :hint and expect the tooltip part to carry the tab's :hint.
Next step
Needs a maintainer to decide whether this is a regression, and to agree the fix.
- Lingua principale
- Clojure
- Stelle
- 825
- Fork
- 144
- Merge medio
- 2h 42m
- PR unite (30g)
- 1
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di day8/re-com
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bar-tabs: :validate? is documented but ignored, so the model assert can no longer be turned offAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 65/100
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 45/100
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 45/100
Issue simili
-
unshaved-yak
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
.Needs Triage .Team/UXWest Misc/Accessibility Priority:P3 Type:New Feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
metabase/metabase#88153 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
editor-code-assistant/eca#717 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
nasa/Common-Metadata-Repository#2544 ·
I maintainer di solito rispondono entro 1 giorno