Skip to content

feat(module:carousel): support nzArrows - #9355

Merged
Laffery merged 3 commits into
NG-ZORRO:masterfrom
Nicoss54:feature/carousel-arrows
Sep 6, 2025
Merged

feat(module:carousel): support nzArrows#9355
Laffery merged 3 commits into
NG-ZORRO:masterfrom
Nicoss54:feature/carousel-arrows

Conversation

@Nicoss54

@Nicoss54 Nicoss54 commented Aug 26, 2025

Copy link
Copy Markdown
Collaborator

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Application (the showcase website) / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Carousel component now support nzArrows input which let the user to display arrow for swipping

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Related: #8826

@codecov

codecov Bot commented Aug 26, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.27%. Comparing base (d92568b) to head (5f1edbe).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9355   +/-   ##
=======================================
  Coverage   92.27%   92.27%           
=======================================
  Files         560      560           
  Lines       19743    19744    +1     
  Branches     3029     3029           
=======================================
+ Hits        18217    18218    +1     
  Misses       1194     1194           
  Partials      332      332           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread components/carousel/style/rtl.less Outdated
@@ -17,22 +17,24 @@

.slick-prev {
.@{carousel-prefix-cls}-rtl & {

@WwwHhhYran WwwHhhYran Aug 27, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I found that when the layout direction is changed to RTL, the prev and next arrows do not adjust their positions. Maybe we should not use .@{carousel-prefix-cls}-rtl & {}, but use the following method instead, WDYT?

&-rlt {
	// ...

	.slick-prev {
		// ...

		&::after {
			// ...
		}
	}
}
截屏2025-08-27 11 31 13

@Nicoss54 Nicoss54 Aug 27, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@WwwHhhYran after checking the documentation of antd, the behavior we have currently without apply suggest change is the same as the official documentation

I suggest to keep it like that to have the same behavior as the officical documentation

WDYT ?

here is a print screen of the official ant design documentation:

Screenshot 2025-08-27 at 15 25 46

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Nicoss54 Yes, I have also checked the antd documentation, but I think it's counterintuitive. I'm not even sure if it's a design specification or a bug, so I will try to confirm this with the antd community

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I agree :) but even if it’s rtl arrow are well designed but I thinks it’s the behavior that changed. Previous become next and next become previous ?

WDYT?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree :) but even if it’s rtl arrow are well designed but I thinks it’s the behavior that changed. Previous become next and next become previous ?

WDYT?

I think we use CSS to move the position of arrows and rotate them just to adapt to the layout direction, but the behavior of pre/next arrow hasn't changed: Clicking on the pre arrow will still switch to the previous content, and similarly, clicking on the next arrow will still switch to the next content.

I'm not sure if my statement is clear, so I'll use an example to illustrate:

When we switch direction to RTL, the next arrow is now on the right and pointing to the right, and after adjustment, the next arrow will be on the left and pointing to the left (Just like the suggested change below #9355 (comment)). At this point, clicking on the next arrow will switch to the second page, and the dots below will also highlight the second one (located to the left of the first dot). This behavior is the same as when the direction is ltr.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

You’re agree. Let’s do that. When you have the feedback of the community I will update the code :)

are you agree with this ? :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@WwwHhhYran do you have any news ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Nicoss54 I'm sorry, I was on vacation a few days ago and didn't reply promptly. The antd community has confirmed that this is a bug ant-design/ant-design#54781

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Hope you have some rest :) so let’s fix it. I will finished the dev today :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@WwwHhhYran it's done, arrow are reverse correctly in rtl mode :)

Comment thread components/carousel/style/rtl.less Outdated
Comment thread components/carousel/style/rtl.less Outdated
@Nicoss54
Nicoss54 force-pushed the feature/carousel-arrows branch from ae2e775 to 89b605d Compare August 28, 2025 08:04
@Laffery Laffery added this to the v20.3 milestone Aug 29, 2025
@Nicoss54
Nicoss54 requested a review from WwwHhhYran September 4, 2025 08:33

@WwwHhhYran WwwHhhYran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment thread components/carousel/carousel.spec.ts Outdated
Comment thread components/carousel/carousel.spec.ts Outdated
@Nicoss54
Nicoss54 force-pushed the feature/carousel-arrows branch from c3b2d09 to 5f1edbe Compare September 5, 2025 08:27
@Nicoss54

Nicoss54 commented Sep 5, 2025

Copy link
Copy Markdown
Collaborator Author

@Laffery your changes requested are done :)

@Laffery Laffery left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@Laffery
Laffery merged commit 1b9714b into NG-ZORRO:master Sep 6, 2025
9 of 10 checks passed
@Nicoss54
Nicoss54 deleted the feature/carousel-arrows branch September 11, 2025 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants