p: only :class and :style from the attribute map reach the DOM, so other attributes and :attr itself are dropped
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 45/100
Direzione di ricerca
Read src/re_com/text.cljs around lines 225-234 (the ::p/wrapper :post-props call) and the standard-impl-keys set near line 185, then src/re_com/part.cljs lines 145-148 to see which keys the default renderer copies. Compare with the v2.28.2 code linked in the issue. Before any fix, a maintainer must settle whether bare attributes or only :attr is supported; once that is decided, model a failing test on test/re_com/checkbox_test.cljs rendering [p {:title "x"} "text"] and [p {:attr {:title "x"}} "text"], and expect :title on the wrapper element in both.
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, the attribute map went straight onto the outer span.
See src/re_com/text.cljs lines 177 to 179 at v2.28.2:
[:span.rc-p
(apply dissoc m standard-impl-keys)
(into [:span] (concat children hiccup-children))]
Any HTML attribute in the map, such as :on-click or :title, was rendered.
Now the same map, still with standard-impl-keys removed, is passed as :post-props to the ::p/wrapper part.
See src/re_com/text.cljs lines 225 to 234 at 66162a21.
That part uses the default renderer, which only copies :class, :style and :attr (src/re_com/part.cljs lines 145 to 148).
Bare attributes are top-level keys, so they are dropped without a warning.
:attr is in standard-impl-keys (line 185), so it is removed before the part sees it.
Only :class and :style get through.
The change arrived with 7cc04b73 (first released in v2.29.0).
Why we think it's a regression
- The docstring still says "If the first child is a map, it is interpreted as a map of styles / attributes" (
text.cljsline 202). - Validation only runs when the map has
:theme,:pre-theme,:parts,:debug-asor:src(line 228). A map such as{:on-click f}is never validated. p-args-desclists:attras an accepted arg (lines 172 to 183), but the code removes it.
At v2.28.2 :attr was also removed, so {:attr {...}} did not work then either.
Our working assumption is that :attr is meant to be the route now, and that it was never wired up.
Question: should bare attributes still work, or only :attr?
Who it affects
Callers that put HTML attributes in the map:
[rc/p {:on-click f :title "More detail"} "Some text"]
Before, the span had the click handler and the title.
Now it has neither.
[rc/p {:attr {:title "More detail"}} "Some text"] does not work either.
Suggested fix
Take :attr out of the keys removed for :post-props, so the documented arg works.
Then either fold the remaining bare keys into :attr, or validate the map every time.
A failing test should come first, modelled on test/re_com/checkbox_test.cljs: render [p {:title "x"} "text"] and [p {:attr {:title "x"}} "text"], and expect :title on the wrapper element in both.
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
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/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
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