Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
[terra-tabs] Deselection of Tab Issue (#2144)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadanKumarGovindaswamy authored Apr 25, 2024
1 parent 2493c09 commit 74e9022
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/terra-tabs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

* Fixed
* Fixes for deselection of tab within more button.
* More button dropdown left position reset to zero when negative.

## 7.28.0 - (April 23, 2024)

* Changed
Expand Down
4 changes: 2 additions & 2 deletions packages/terra-tabs/src/common-tabs/_Tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ class Tabs extends React.Component {
offset = parentOffset + leftEdge + widthDelta;
}

this.dropdownRef.current.style.left = `${offset}px`;
this.dropdownRef.current.style.left = (offset > 0) ? `${offset}px` : '0px';
// Dropdown menu gets truncated when the left edge is less than or equal to zero. setting min-width will help to fix this issue.
if (!leftEdge) {
this.dropdownRef.current.style.minWidth = `${moreRect.width}px`;
Expand All @@ -439,7 +439,7 @@ class Tabs extends React.Component {
if (this.isOpen) {
const updatedTabData = this.state.visibleTabData.map((tab) => ({
...tab,
isSelected: tab.id === itemKey,
isSelected: tab.itemKey === itemKey,
}));
this.setState({ visibleTabData: updatedTabData }, () => {
onSelect(itemKey, metaData);
Expand Down

0 comments on commit 74e9022

Please sign in to comment.