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

feat(tabs): add support for scrolling via mouse wheel or touchpad #3105

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

oljc
Copy link
Member

@oljc oljc commented Apr 28, 2024

Types of changes

  • New feature
  • Bug fix
  • Enhancement
  • Component style change
  • Typescript definition change
  • Documentation change
  • Coding style change
  • Refactoring
  • Test cases
  • Continuous integration
  • Breaking change
  • Others

Background and context

Tabs 组件支持滚轮或者触摸板进行滚动、以及增加滚动定位 scrollPosition 与 React 版本一致。

Resolves #2909
Resolves #2804
Resolves #2100
Resolves #1867
Closes #2209
Closes #1936

Solution

setActiveTabOffset 来统一计算各种情况下的偏移量。移除了原来逻辑tabEndOffsets 相关的 isInView、getTabEndOffsets 等函数,优化几处冗余的代码。

此外本次新功能也解决了几处历史问题如在 #1936 所讨论的问题

How is the change tested?

测试脚本外还打包到项目中测试无异常。

Changelog

Component Changelog(CN) Changelog(EN) Related issues
Tabs 支持滚轮或者触摸板进行滚动 add support for scrolling via mouse wheel or touchpad Closes #2909

Checklist:

  • Test suite passes (npm run test)
  • Provide changelog for relevant changes (e.g. bug fixes and new features) if applicable.
  • Changes are submitted to the appropriate branch (e.g. features should be submitted to feature branch and others
    should be submitted to main branch)

Other information

iShot_2024-04-28.mp4

Copy link

codesandbox bot commented Apr 28, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

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