From 5ca5a0659582fd848db0c5fb58dece5033a2a035 Mon Sep 17 00:00:00 2001 From: Martin Bohal Date: Tue, 26 Sep 2023 11:00:46 +0200 Subject: [PATCH] Define strategy how to transfer HTML attributes to the component and accordingly modify the `TabsItem` component --- CONTRIBUTING.md | 8 ++++++++ src/components/Tabs/README.md | 2 +- src/components/Tabs/TabsItem.jsx | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5030f6c7..9f29881d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -164,6 +164,14 @@ To keep React UI consistent and predictable the following guidelines should be o 1. If component accepts the `children` prop it should be either required or the element should return `null` when no children are provided. +2. When forwarding HTML attributes to the component the following rules should + be observed: + 1. If the component internally instantiates one or more interactive + (clickable/editable) elements, the attributes should be forwarded to + all of them. + 2. If the component does not internally instantiate an interactive + (clickable/editable) element, the attributes should be forwarded to the + root element of the component. ## Documenting diff --git a/src/components/Tabs/README.md b/src/components/Tabs/README.md index ea968e70..e419ea05 100644 --- a/src/components/Tabs/README.md +++ b/src/components/Tabs/README.md @@ -159,7 +159,7 @@ React.createElement(() => { In addition to the options below in the [component's API](#api) section, you can specify [React synthetic events] or **any HTML attribute you like.** All attributes that don't interfere with the API are forwarded to the `