Skip to content

Commit 9fd863d

Browse files
theMasudRanaCopilot
andauthored
[Release]: Prepare release for 2.0.1 (#130)
* chore(release): 2.0.1 Co-authored-by: Copilot <copilot@github.com> * fix: Changelog list * feat: add deprecation handling for block save changes Co-authored-by: Copilot <copilot@github.com> * fix: update deprecation guidelines for block save changes Co-authored-by: Copilot <copilot@github.com> --------- Co-authored-by: Copilot <copilot@github.com>
1 parent b7a2240 commit 9fd863d

8 files changed

Lines changed: 164 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## [2.0.1](https://github.com/rtCamp/rt-carousel/compare/v2.0.0...v2.0.1) (2026-05-04)
4+
5+
6+
### Features
7+
8+
* add a11y announcements for carousel slide changes ([#125](https://github.com/rtCamp/rt-carousel/issues/125)) ([b7a2240](https://github.com/rtCamp/rt-carousel/commit/b7a2240))
9+
10+
11+
### Bug Fixes
12+
13+
* carousel dot focus loss with VoiceOver activation ([#127](https://github.com/rtCamp/rt-carousel/issues/127)) ([366031e](https://github.com/rtCamp/rt-carousel/commit/366031e))
14+
15+
16+
### Refactors
17+
18+
* replace automatic plugin deactivation with admin notice ([#129](https://github.com/rtCamp/rt-carousel/issues/129)) ([279a464](https://github.com/rtCamp/rt-carousel/commit/279a464))
19+
20+
321
## [2.0.0](https://github.com/rtCamp/rt-carousel/compare/v1.0.4...v2.0.0) (2026-04-13)
422

523

docs/CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@ Thank you for your interest in contributing! We welcome all contributions, from
3030
- **JavaScript/TypeScript**: We use the standard WordPress ESLint config. Run `npm run lint:js` to check.
3131
- **CSS/SCSS**: We use Stylelint. Run `npm run lint:css` to check.
3232

33+
## Block `save()` Changes
34+
35+
If your changes modify a block's `save()` output — including `data-wp-context`, HTML structure, class names, or new elements — you **must** add a deprecation entry in the block's `deprecated.tsx`.
36+
37+
1. Copy the previous `save()` function into the `deprecated` array.
38+
2. Include the `attributes` and `supports` from the old version (copy the full `supports` from `block.json` — don't simplify it, or alignment/color classes will fail validation).
39+
3. For blocks with inner blocks, use `useInnerBlocksProps.save()` in the deprecated `save()` function, just like the current save does.
40+
41+
Without this, existing content will show "Block contains unexpected or invalid content" errors in the editor.
42+
43+
See the [Block Deprecation API](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-deprecation/) for details.
44+
3345
## Building the Plugin
3446
3547
To create a production-ready ZIP file:

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rt-carousel",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Carousel block using Embla and WordPress Interactivity API",
55
"author": "rtCamp",
66
"private": true,

readme.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: carousel, slider, block, interactivity-api, embla
44
Requires at least: 6.6
55
Tested up to: 6.9
66
Requires PHP: 8.2
7-
Stable tag: 2.0.0
7+
Stable tag: 2.0.1
88
License: GPL-2.0-or-later
99
License URI: https://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -85,6 +85,12 @@ rtCarousel is the successor to Carousel Kit. Simply install and activate rtCarou
8585

8686
== Changelog ==
8787

88+
= 2.0.1 =
89+
* New: Add a11y announcements for carousel slide changes
90+
* Fix: Carousel dot focus loss with VoiceOver activation
91+
* Refactor: Replace automatic plugin deactivation with an admin notice
92+
93+
8894
= 2.0.0 =
8995
* New: Carousel progress bar block
9096
* New: Vertical alignment support for carousel slides

rt-carousel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Domain Path: /languages
1111
* License: GPL-2.0-or-later
1212
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
13-
* Version: 2.0.0
13+
* Version: 2.0.1
1414
* Text Domain: rt-carousel
1515
*
1616
* @package rt-carousel

src/blocks/carousel/deprecated.tsx

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
2+
import { __ } from '@wordpress/i18n';
3+
import type { CarouselAttributes } from './types';
4+
5+
/**
6+
* v2.0.0 save — before a11y announcement fields were added to context
7+
* and the live-region <span> was appended.
8+
*
9+
* @param {Object} root0 Component props.
10+
* @param {CarouselAttributes} root0.attributes Block attributes.
11+
*/
12+
function SaveV200( {
13+
attributes,
14+
}: {
15+
attributes: CarouselAttributes;
16+
} ) {
17+
const {
18+
loop,
19+
dragFree,
20+
carouselAlign,
21+
containScroll,
22+
direction,
23+
autoplay,
24+
autoplayDelay,
25+
autoplayStopOnInteraction,
26+
autoplayStopOnMouseEnter,
27+
ariaLabel,
28+
slideGap,
29+
axis,
30+
height,
31+
slidesToScroll,
32+
} = attributes;
33+
34+
const context = {
35+
options: {
36+
loop,
37+
dragFree,
38+
align: carouselAlign,
39+
containScroll,
40+
direction,
41+
axis,
42+
slidesToScroll: slidesToScroll === 'auto' ? 'auto' : parseInt( slidesToScroll, 10 ),
43+
},
44+
autoplay: autoplay
45+
? {
46+
delay: autoplayDelay,
47+
stopOnInteraction: autoplayStopOnInteraction,
48+
stopOnMouseEnter: autoplayStopOnMouseEnter,
49+
}
50+
: false,
51+
isPlaying: !! autoplay,
52+
timerIterationId: 0,
53+
selectedIndex: -1,
54+
scrollSnaps: [] as { index: number }[],
55+
canScrollPrev: false,
56+
canScrollNext: false,
57+
scrollProgress: 0,
58+
slideCount: 0,
59+
/* translators: %d: slide number */
60+
ariaLabelPattern: __( 'Go to slide %d', 'rt-carousel' ),
61+
};
62+
63+
const blockProps = useBlockProps.save( {
64+
className: 'rt-carousel',
65+
role: 'region',
66+
'aria-roledescription': 'carousel',
67+
'aria-label': ariaLabel,
68+
dir: direction,
69+
'data-axis': axis,
70+
'data-loop': loop ? 'true' : undefined,
71+
'data-wp-interactive': 'rt-carousel/carousel',
72+
'data-wp-context': JSON.stringify( context ),
73+
'data-wp-init': 'callbacks.initCarousel',
74+
style: {
75+
'--rt-carousel-gap': `${ slideGap }px`,
76+
'--rt-carousel-height': axis === 'y' ? height : undefined,
77+
} as React.CSSProperties,
78+
} );
79+
80+
const innerBlocksProps = useInnerBlocksProps.save( blockProps ) as ReturnType<
81+
typeof useInnerBlocksProps.save
82+
> & {
83+
children: React.ReactNode;
84+
};
85+
86+
return <div { ...innerBlocksProps } />;
87+
}
88+
89+
const deprecated = [
90+
{
91+
attributes: {
92+
allowedSlideBlocks: { type: 'array' as const, default: [] },
93+
loop: { type: 'boolean' as const, default: false },
94+
dragFree: { type: 'boolean' as const, default: false },
95+
carouselAlign: { type: 'string' as const, default: 'start' },
96+
containScroll: { type: 'string' as const, default: 'trimSnaps' },
97+
direction: { type: 'string' as const, default: 'ltr' },
98+
axis: { type: 'string' as const, default: 'x' },
99+
height: { type: 'string' as const, default: '300px' },
100+
autoplay: { type: 'boolean' as const, default: false },
101+
autoplayDelay: { type: 'number' as const, default: 4000 },
102+
autoplayStopOnInteraction: { type: 'boolean' as const, default: true },
103+
autoplayStopOnMouseEnter: { type: 'boolean' as const, default: false },
104+
ariaLabel: { type: 'string' as const, default: 'Carousel' },
105+
slideGap: { type: 'number' as const, default: 0 },
106+
slidesToScroll: { type: 'string' as const, default: '1' },
107+
},
108+
supports: {
109+
interactivity: true,
110+
align: [ 'wide', 'full' ],
111+
html: false,
112+
color: {
113+
text: false,
114+
background: true,
115+
},
116+
},
117+
save: SaveV200,
118+
},
119+
];
120+
121+
export default deprecated;

src/blocks/carousel/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
} from '@wordpress/blocks';
66
import Edit from './edit';
77
import Save from './save';
8+
import deprecated from './deprecated';
89
import './style.scss';
910
import './editor.scss';
1011
import metadata from './block.json';
@@ -14,6 +15,7 @@ import { __ } from '@wordpress/i18n';
1415
registerBlockType( metadata as BlockConfiguration<CarouselAttributes>, {
1516
edit: Edit,
1617
save: Save,
18+
deprecated,
1719
} );
1820

1921
const styles = [

0 commit comments

Comments
 (0)