Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Tabs): handle activation mode scrolling in separate useIsomorphicEffects #17920

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

emyarod
Copy link
Member

@emyarod emyarod commented Oct 30, 2024

NOTE: there is a test story that should be removed before merge


Closes #17274

This PR updates the Tab component to scroll programmatically selected tabs into view, regardless of tab activation type

Prior to this PR, Tabs in manual activation mode would only scroll when the active tab changed. Normally this is not an issue but when the selected tab is modified programmatically, the lack of user interaction means the selection does not occur on the active tab.

By splitting the existing useIsomorphicEffect into two separate hooks, they can handle manual and auto activation modes separately. This ensures that the component will scroll as needed both when changing the selected tab and when changing the active tab in manual `activation mode

Changelog

New

  • scrollTabIntoView Tab method

Changed

  • split existing useIsomorphicEffect that handled scrolling into two distinct useIsomorphicEffects for each activation mode

Testing / Reviewing

  • visit the temporary Test Tabs story
  • confirm that both activation modes will scroll the correct tabs into view as needed

@emyarod emyarod requested a review from a team as a code owner October 30, 2024 20:02
Copy link

netlify bot commented Oct 30, 2024

Deploy Preview for v11-carbon-web-components ready!

Name Link
🔨 Latest commit ea3971d
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-web-components/deploys/672290d4c7839c0008526447
😎 Deploy Preview https://deploy-preview-17920--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@emyarod emyarod changed the title 17274-fix/manual-tabs-scroll-into-view-programmatic fix(Tabs): handle scrolling for activation modes in separate useIsomorphicEffects Oct 30, 2024
@emyarod emyarod changed the title fix(Tabs): handle scrolling for activation modes in separate useIsomorphicEffects fix(Tabs): handle activation mode scrolling in separate useIsomorphicEffects Oct 30, 2024
Copy link

netlify bot commented Oct 30, 2024

Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit ea3971d
🔍 Latest deploy log https://app.netlify.com/sites/carbon-elements/deploys/672290d4a950690008bc5053
😎 Deploy Preview https://deploy-preview-17920--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Oct 30, 2024

Deploy Preview for v11-carbon-react ready!

Name Link
🔨 Latest commit ea3971d
🔍 Latest deploy log https://app.netlify.com/sites/v11-carbon-react/deploys/672290d4ca0ae80008facbb1
😎 Deploy Preview https://deploy-preview-17920--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

Attention: Patch coverage is 41.17647% with 10 lines in your changes missing coverage. Please review.

Project coverage is 81.18%. Comparing base (75c827d) to head (ea3971d).
Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
packages/react/src/components/Tabs/Tabs.tsx 41.17% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17920      +/-   ##
==========================================
+ Coverage   81.16%   81.18%   +0.02%     
==========================================
  Files         406      406              
  Lines       14046    14051       +5     
  Branches     4354     4354              
==========================================
+ Hits        11400    11408       +8     
+ Misses       2480     2477       -3     
  Partials      166      166              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@kennylam kennylam left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@alisonjoseph alisonjoseph left a comment

Choose a reason for hiding this comment

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

LGTM!

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.

[Bug]: Tab does not scrollIntoView when selected tab is changed programmatically and activation is manual
3 participants