Skip to content

fix: Alignment issues with 'unsaved changes' badge in Feature modal#6949

Open
alveyworld wants to merge 3 commits intoFlagsmith:mainfrom
alveyworld:main
Open

fix: Alignment issues with 'unsaved changes' badge in Feature modal#6949
alveyworld wants to merge 3 commits intoFlagsmith:mainfrom
alveyworld:main

Conversation

@alveyworld
Copy link

@alveyworld alveyworld commented Mar 13, 2026

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Closes issue #6935

In the .unread selector, simply changing the bottom attribute to a positive 9px brought the * badge up to vertical center without moving the position or size of the tab.

How did you test this code?

Steps to reproduce

  1. Open any feature (Edit Feature modal)
  2. Click on the "Segment Overrides" tab
  3. Make a change to a segment override (toggle enabled, change value, etc.) — the purple * badge appears
  4. Observe the badge is now vertically centered and not overlapping the baseline of the tabs
  5. Switch to "Identity Overrides" tab — the badge still shows under the now-inactive "Segment Overrides" tab

I followed these steps to recreate and visually fixed the css issue. I resized the window to extreme small and large sized and the badge remained in place. At smaller sizes it naturally jumps up to the right of the tab.

Before
Screenshot 2026-03-17 at 8 28 04 AM
After
Screenshot 2026-03-17 at 8 28 49 AM

@alveyworld alveyworld requested a review from a team as a code owner March 13, 2026 23:13
@alveyworld alveyworld requested review from kyle-ssg and removed request for a team March 13, 2026 23:13
@claude
Copy link

claude bot commented Mar 13, 2026

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.

Once credits are available, reopen this pull request to trigger a review.

@vercel
Copy link

vercel bot commented Mar 13, 2026

@alveyworld is attempting to deploy a commit to the Flagsmith Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added the front-end Issue related to the React Front End Dashboard label Mar 13, 2026
@matthewelwell matthewelwell changed the title Update _utils.scss fix: Alignment issues with 'unsaved changes' badge in Feature modal Mar 16, 2026
@vercel
Copy link

vercel bot commented Mar 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Mar 16, 2026 7:05am
flagsmith-frontend-staging Ready Ready Preview, Comment Mar 16, 2026 7:05am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Mar 16, 2026 7:05am

Request Review

@talissoncosta
Copy link
Contributor

Hey @alveyworld , thanks for picking this up! 🙏

Could you add before/after screenshots to the PR description? It'll help us validate the fix visually and speed up the review.

Thanks again for the contribution!

@alveyworld
Copy link
Author

I added the screen shots. I hope this is what you were wanting

@kyle-ssg
Copy link
Member

Thanks for this @alveyworld! I think actually you might have spotted a regression whereby the real fix is to add a flex-wrap no wrap. Happy to merge this if we get that done!

image

@talissoncosta
Copy link
Contributor

Hey @alveyworld, thanks for the screenshots and for sticking with this!

Building on what Kyle mentioned — .unread in _utils.scss is a global class used across the app (navbar badges, table filters, diff counters), so the bottom: 9px change there would affect those places too.

The root cause of the badge misalignment is actually .tab-nav-full in _tabs.scss — it applies flex: 1 to each tab button, stretching them and causing the badge to overflow below the underline.

Here's a nudge on the approach:

  • web/styles/components/_tabs.scss — remove the .tab-nav-full rule
  • web/components/navigation/TabMenu/Tabs.tsx — remove canGrow and the tab-nav-full className, then add justify-content-evenly to the inner container's className (line 141) to keep tabs distributed evenly
  • web/components/navigation/TabMenu/TabButton.tsx — clean up the now-unused className prop
  • web/styles/project/_utils.scss — revert bottom back to -1px

Here's what the expected result should look like:

image

This way tabs still spread out nicely, but buttons keep their natural width so the badge stays aligned. Happy to answer any questions!

@talissoncosta
Copy link
Contributor

@kyle-ssg .tabs-nav already has flex-wrap: nowrap (line 70 of _tabs.scss) and buttons have flex: 0 0 auto (line 77). The issue is .tab-nav-full overriding that with flex: 1 !important — that's what stretches the buttons and causes both the badge misalignment and the wrapping in your screenshot.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is kicking off a free cloud agent to fix these issues. This run is complimentary, but you can enable autofix for all future PRs in the Cursor dashboard.

<div
ref={itemsContainerRef}
className={classNames('d-flex align-items-center flex-1', 'gap-2', {
className={classNames('justify-content-evenly','d-flex align-items-center flex-1', 'gap-2', {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Global tab layout changed by justify-content-evenly addition

High Severity

Adding justify-content-evenly to the items container in the Tabs component and removing the tab-nav-full class affects every tab instance across the app (EditPermissions, PermissionsTabs, DiffFeature, DiffSegment, etc.), not just the Feature modal tabs targeted by this fix. Previously tabs were packed at the start with optional flex: 1 growing; now they're evenly distributed across the full width regardless of context. As the reviewers noted, the root cause is .tab-nav-full overriding flex, and a scoped fix is needed rather than a global layout change.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bugbot Autofix determined this is a false positive.

The current Tabs implementation does not add justify-content-evenly and still applies tab-nav-full conditionally, so the reported global layout regression is not present.

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

key={`button-${i}`}
isSelected={isSelected}
className={canGrow ? 'tab-nav-full' : ''}
className={''}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable canGrow computed but never used

Low Severity

The canGrow variable (line 107) is still computed but no longer referenced anywhere. It was previously used to conditionally apply the tab-nav-full class, but now className is hardcoded to ''. This is dead code that will likely trigger lint warnings.

Fix in Cursor Fix in Web

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bugbot Autofix determined this is a false positive.

canGrow is actively used to set each TabButton class (tab-nav-full) in Tabs.tsx, so it is not dead code.

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@cursor
Copy link

cursor bot commented Mar 23, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@alveyworld
Copy link
Author

Thanks for your help @talissoncosta
I made your suggested changes and got the desired results from the screen shot with the badges inline with the tab instead of underneath. Cursor is reporting some deadcode on this PR so I will need to clean that up.

@alveyworld
Copy link
Author

Also, it looks like it did not fix similar tabs in areas like the group editor

@talissoncosta
Copy link
Contributor

Hey @alveyworld, good progress — the core fix is correct and addresses the reported issue!

A few things to tidy up before this is merge-ready:

1. Remove canGrow — line 107 in Tabs.tsx computes it but nothing uses it anymore. Delete the whole line.

2. Clean up TabButton.tsx — since no caller passes className anymore, remove it from:

  • The TabButtonProps interface
  • The destructured props
  • The template literal in the <Button> className

Then in Tabs.tsx, remove className={''} from the <TabButton> call entirely (instead of passing an empty string).

3. Formatting nit — add a space after the comma:
'justify-content-evenly', 'd-flex align-items-center flex-1'

Re: the tabs you mentioned in other areas (like the group editor) — could you share a screenshot showing the specific issue? Those might be pill-style tabs which use a different layout path and wouldn't be affected by this change.

Copy link
Contributor

@talissoncosta talissoncosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@talissoncosta talissoncosta removed the request for review from kyle-ssg March 24, 2026 14:19
@alveyworld
Copy link
Author

Here is the group tab I mentioned
Screenshot 2026-03-24 at 10 36 55 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants