Skip to content

Commit 5cc8b75

Browse files
authored
fix (block deprecations): add anchor to attributes to fix block migration (#3600)
1 parent 094c6d0 commit 5cc8b75

File tree

6 files changed

+100
-1
lines changed

6 files changed

+100
-1
lines changed

src/block/carousel/deprecated.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,24 @@ addFilter( 'stackable.carousel.save.slider-props', 'stackable/3.19.0', ( sliderP
2222
} )
2323

2424
const deprecated = [
25+
{
26+
// Handle the migration for adding tabIndex
27+
// add anchor in the attributes to fix block validation error for blocks with anchors
28+
attributes: {
29+
...attributes( '3.18.1' ),
30+
anchor: {
31+
attribute: 'id',
32+
selector: '*',
33+
source: 'attribute',
34+
type: 'string',
35+
},
36+
},
37+
// dev note: using withVersion HOC still results to a block validation error so we manually add the version here
38+
save: ( props => {
39+
props.version = '3.18.1'
40+
return Save( props )
41+
} ),
42+
},
2543
{
2644
// Handle the migration of shadow attributes with the change of type in 3.15.3
2745
attributes: attributes( '3.16.2' ),

src/block/horizontal-scroller/deprecated.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,24 @@ addFilter( 'stackable.horizontal-scroller.save.contentClassNames', 'stackable/3_
3434
} )
3535

3636
const deprecated = [
37+
{
38+
// Handle the migration for adding tabIndex
39+
// add anchor in the attributes to fix block validation error for blocks with anchors
40+
attributes: {
41+
...attributes( '3.18.1' ),
42+
anchor: {
43+
attribute: 'id',
44+
selector: '*',
45+
source: 'attribute',
46+
type: 'string',
47+
},
48+
},
49+
// dev note: using withVersion HOC still results to a block validation error so we manually add the version here
50+
save: ( props => {
51+
props.version = '3.18.1'
52+
return Save( props )
53+
} ),
54+
},
3755
{
3856
// Handle the migration of shadow attributes with the change of type in 3.15.3
3957
attributes: attributes( '3.16.2' ),

src/block/notification/deprecated.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,24 @@ addFilter( 'stackable.notification.save.innerClassNames', 'stackable/3.8.0', ( o
5050
} )
5151

5252
const deprecated = [
53+
{
54+
// Trigger the migration for adding aria-label
55+
// add anchor in the attributes to fix block validation error for blocks with anchors
56+
attributes: {
57+
...attributes( '3.18.1' ),
58+
anchor: {
59+
attribute: 'id',
60+
selector: '*',
61+
source: 'attribute',
62+
type: 'string',
63+
},
64+
},
65+
// dev note: using withVersion HOC still results to a block validation error so we manually add the version here
66+
save: ( props => {
67+
props.version = '3.18.1'
68+
return Save( props )
69+
} ),
70+
},
5371
{
5472
// Handle the migration of shadow attributes with the change of type in 3.15.3
5573
attributes: attributes( '3.16.2' ),

src/block/posts/deprecated.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,24 @@ addFilter( 'stackable.posts.feature-image', 'stackable/3_6_3', determineFeatureI
6868
addFilter( 'stackable.posts.meta', 'stackable/3.19.0', fixMetaAccessibility )
6969

7070
const deprecated = [
71+
{
72+
// Handle the migration for changing the HTML tag of meta props for accessibility
73+
// add anchor in the attributes to fix block validation error for blocks with anchors
74+
attributes: {
75+
...attributes( '3.18.1' ),
76+
anchor: {
77+
attribute: 'id',
78+
selector: '*',
79+
source: 'attribute',
80+
type: 'string',
81+
},
82+
},
83+
// dev note: using withVersion HOC still results to a block validation error so we manually add the version here
84+
save: ( props => {
85+
props.version = '3.18.1'
86+
return Save( props )
87+
} ),
88+
},
7189
{
7290
// Support the change of type for border radius
7391
attributes: attributes( '3.16.3' ),

src/block/progress-bar/deprecated.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,24 @@ const addAriaLabel = ( divProps, props ) => {
2525
addFilter( 'stackable.progress-bar.div-props', 'stackable/3.19.0', addAriaLabel )
2626

2727
const deprecated = [
28+
{
29+
// Trigger the migration for adding aria-label
30+
// add anchor in the attributes to fix block validation error for blocks with anchors
31+
attributes: {
32+
...attributes( '3.18.1' ),
33+
anchor: {
34+
attribute: 'id',
35+
selector: '*',
36+
source: 'attribute',
37+
type: 'string',
38+
},
39+
},
40+
// dev note: using withVersion HOC still results to a block validation error so we manually add the version here
41+
save: ( props => {
42+
props.version = '3.18.1'
43+
return Save( props )
44+
} ),
45+
},
2846
{
2947
// Handle the migration of shadow attributes with the change of type in 3.15.3
3048
attributes: attributes( '3.16.2' ),

src/block/progress-circle/deprecated.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,16 @@ addFilter( 'stackable.progress-circle.div-props', 'stackable/3.19.0', addAriaLab
2727
const deprecated = [
2828
{
2929
// Trigger the migration for adding aria-label
30-
attributes: attributes( '3.18.1' ),
30+
// add anchor in the attributes to fix block validation error for blocks with anchors
31+
attributes: {
32+
...attributes( '3.18.1' ),
33+
anchor: {
34+
attribute: 'id',
35+
selector: '*',
36+
source: 'attribute',
37+
type: 'string',
38+
},
39+
},
3140
// dev note: using withVersion HOC still results to a block validation error so we manually add the version here
3241
save: ( props => {
3342
props.version = '3.18.1'

0 commit comments

Comments
 (0)