File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ import AbstractDomElement from './AbstractDomElement'
2+
3+ // ----
4+ // class
5+ // ----
6+ class ImageBlock extends AbstractDomElement {
7+ constructor ( element , options ) {
8+ const instance = super ( element , options )
9+
10+ // avoid double init :
11+ if ( ! instance . isNewInstance ( ) ) {
12+ return instance
13+ }
14+
15+ const el = this . _element
16+ const figure = el . closest ( '.wp-block-image' )
17+
18+ figure . setAttribute ( 'role' , 'group' )
19+ figure . setAttribute ( 'aria-label' , el . textContent )
20+ }
21+ }
22+
23+ // ----
24+ // init
25+ // ----
26+ ImageBlock . init ( '.wp-block-image figcaption' )
27+
28+ // ----
29+ // export
30+ // ----
31+ export default ImageBlock
Original file line number Diff line number Diff line change @@ -4,3 +4,4 @@ import './classes/ScrollDirection'
44import './classes/ButtonSeoClick'
55import './classes/Header'
66import './classes/Animation'
7+ import './classes/ImageBlock'
You can’t perform that action at this time.
0 commit comments