From 62a4f7477e79110c1a78c0bd236253ad820766ca 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 | 10 ++++++++++ src/components/Tabs/README.md | 2 +- src/components/Tabs/TabsItem.jsx | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5030f6c7..34530881 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -164,6 +164,16 @@ 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 an interactive + (clickable/editable) element, the attributes should be forwarded to it. + 2. If the component internally instantiates multiple interactive + (clickable/editable) elements, the attributes should be forwarded to + them. + 3. 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 `