Skip to content

Conversation

@RamVinayMandal
Copy link
Contributor

@RamVinayMandal RamVinayMandal commented Nov 3, 2025

💡 What is the current behavior?

When tabs are added dynamically and have custom CSS classes applied, the essential default CSS classes (hydrated, bottom/top, auto/stretched, selected) are lost, causing the tabs to appear broken/unstyled. Issue persists for React and Vue.

GitHub Issue Number: #2043

Note: Older PR is closed due to major conflicts - #2082

🆕 What is the new behavior?

Dynamic CSS Class Preservation for Tab Components

Problem Fixed: When React/Vue frameworks dynamically update tab content, essential CSS classes (hydrated, selected, bottom, top, stretched) were lost, breaking tab functionality and styling.

Solution Implemented: Added a MutationObserver that automatically detects DOM changes and re-applies required system classes while preserving custom user classes, ensuring tabs remain fully functional during dynamic re-renders.

Result: Tabs now work seamlessly in React/Vue applications with dynamic content updates, maintaining both visual consistency and interactive behavior regardless of how aggressively frameworks manipulate the DOM.

🏁 Checklist

A pull request can only be merged if all of these conditions are met (where applicable):

  • 🦮 Accessibility (a11y) features were implemented
  • 🗺️ Internationalization (i18n) - no hard coded strings
  • 📲 Responsiveness - components handle viewport changes and content overflow gracefully
  • 📕 Add or update a Storybook story
  • 📄 Documentation was reviewed/updated siemens/ix-docs
  • 🧪 Unit tests were added/updated and pass (pnpm test)
  • 📸 Visual regression tests were added/updated and pass (Guide)
  • 🧐 Static code analysis passes (pnpm lint)
  • 🏗️ Successful compilation (pnpm build, changes pushed)

@changeset-bot
Copy link

changeset-bot bot commented Nov 3, 2025

⚠️ No Changeset found

Latest commit: 41746a6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @RamVinayMandal, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses an issue where dynamically added tabs in React and Vue applications were losing essential CSS classes, causing them to appear unstyled. The solution introduces a MutationObserver to monitor DOM changes and re-apply the necessary classes, ensuring tabs remain functional and visually consistent during dynamic updates. Additional regression tests have been added to validate the fix and cover various scenarios.

Highlights

  • Dynamic CSS Class Preservation: Implements a MutationObserver to detect DOM changes in tab components and re-apply essential CSS classes (hydrated, selected, bottom, top, stretched) while preserving custom user classes.
  • Tab Attribute Updates: Adds methods to set and apply required classes to tab items, ensuring visual consistency and interactive behavior during dynamic re-renders in frameworks like React and Vue.
  • Test Cases: Adds new regression tests to verify that default classes are preserved when custom classes are added during re-renders, and to ensure correct behavior with different configurations (placement, layout, disabled state).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request effectively resolves the issue of CSS classes being lost on dynamic tab updates by introducing a MutationObserver. The approach is solid, and the new logic is well-supported by a comprehensive suite of new tests. I have one suggestion for improvement in tabs.tsx to make the class application logic more efficient and prevent potential performance issues from unnecessary DOM mutations. Overall, this is a great contribution.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 3, 2025

@RamVinayMandal RamVinayMandal changed the title Implementation added from previous PR ix/pull/2082 Fix ix 3104 default css classes not getting applied for dynamic tabs Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant