Skip to content

Commit

Permalink
fix: failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alaa-yahia committed Jun 15, 2024
1 parent 39da6ea commit 4841273
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions components/tab/src/tab-bar/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,19 @@ const Tabs = ({ children, fixed, dataTest }) => {
tabIndex={0}
onKeyDown={handleKeyDown}
>
{React.Children.map(children, (child, index) =>
React.cloneElement(child, {
ref: childrenRefs[index],
})
)}
{React.Children.map(children, (child, index) => {
if (React.isValidElement(child)) {
return React.cloneElement(child, {
ref: childrenRefs[index],
})
}
// Wrap non-element children e.g string in a <span>
return (
<span ref={childrenRefs[index]} tabIndex={-1}>
{child}
</span>
)
})}

<style jsx>{`
div {
Expand Down

0 comments on commit 4841273

Please sign in to comment.