🐛 Fix id prop on switch component (#8915)

This commit is contained in:
Eva Marco 2026-04-09 12:35:34 +02:00 committed by GitHub
parent ef39afe9b5
commit 290f37425f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View File

@ -19,6 +19,7 @@
- Fix title on shared button [Taiga #13730](https://tree.taiga.io/project/penpot/issue/13730) - Fix title on shared button [Taiga #13730](https://tree.taiga.io/project/penpot/issue/13730)
- Fix hover on layers [Taiga #13799](https://tree.taiga.io/project/penpot/issue/13799) - Fix hover on layers [Taiga #13799](https://tree.taiga.io/project/penpot/issue/13799)
- Fix highlight after name edition [Taiga #13783](https://tree.taiga.io/project/penpot/issue/13783) - Fix highlight after name edition [Taiga #13783](https://tree.taiga.io/project/penpot/issue/13783)
- Fix id prop on switch component [Taiga #13534](https://tree.taiga.io/project/penpot/issue/13534)
## 2.14.2 ## 2.14.2

View File

@ -16,7 +16,6 @@
(def ^:private schema:switch (def ^:private schema:switch
[:map [:map
[:id {:optional true} :string]
[:class {:optional true} :string] [:class {:optional true} :string]
[:label {:optional true} [:maybe :string]] [:label {:optional true} [:maybe :string]]
[:aria-label {:optional true} [:maybe :string]] [:aria-label {:optional true} [:maybe :string]]
@ -26,10 +25,12 @@
(mf/defc switch* (mf/defc switch*
{::mf/schema schema:switch} {::mf/schema schema:switch}
[{:keys [id class label aria-label default-checked on-change disabled] :rest props} ref] [{:keys [class label aria-label default-checked on-change disabled] :rest props} ref]
(let [checked* (mf/use-state default-checked) (let [checked* (mf/use-state default-checked)
checked? (deref checked*) checked? (deref checked*)
id (mf/use-id)
disabled? (d/nilv disabled false) disabled? (d/nilv disabled false)
has-label? (not (str/blank? label)) has-label? (not (str/blank? label))

View File

@ -114,8 +114,7 @@
:class (stl/css :theme-row)} :class (stl/css :theme-row)}
[:div {:class (stl/css :theme-switch-row)} [:div {:class (stl/css :theme-switch-row)}
[:> switch* {:id name [:> switch* {:label name
:label name
:on-change on-switch-theme :on-change on-switch-theme
:default-checked selected?}]] :default-checked selected?}]]