File tree 2 files changed +28
-2
lines changed
src/content-handlers/iiif/modules
uv-moreinforightpanel-module
2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ export class MoreInfoDialogue extends Dialogue<
49
49
) ;
50
50
this . $content . append ( this . $title ) ;
51
51
52
- this . $metadata = $ ( '<div class="iiif-metadata-component"></div >' ) ;
52
+ this . $metadata = $ ( '<article class="iiif-metadata-component"></article >' ) ;
53
53
this . $content . append ( this . $metadata ) ;
54
54
55
55
this . metadataComponent = new MetadataComponent ( {
@@ -98,5 +98,18 @@ export class MoreInfoDialogue extends Dialogue<
98
98
99
99
resize ( ) : void {
100
100
this . setDockedPosition ( ) ;
101
+
102
+ // always put tabindex on, so the metadata is focusable,
103
+ // just in case there's something wrong with the height
104
+ // comparison below
105
+ this . $metadata . attr ( 'tabindex' , 0 ) ;
106
+ this . $metadata . attr ( 'aria-label' , this . config . content . title ) ;
107
+
108
+ // if metadata's first group's height is lte than metadata (200px fixed I think),
109
+ // there's no scroll happening, so no focus needed, and no aria label either
110
+ if ( this . $metadata . find ( '.groups' ) . first ( ) . height ( ) <= this . $metadata . height ( ) ) {
111
+ this . $metadata . removeAttr ( 'tabindex' ) ;
112
+ this . $metadata . removeAttr ( 'aria-label' ) ;
113
+ }
101
114
}
102
115
}
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export class MoreInfoRightPanel extends RightPanel<MoreInfoRightPanelConfig> {
33
33
34
34
this . setTitle ( this . config . content . title ) ;
35
35
36
- this . $metadata = $ ( '<div class="iiif-metadata-component"></div >' ) ;
36
+ this . $metadata = $ ( '<article class="iiif-metadata-component"></article >' ) ;
37
37
this . $main . append ( this . $metadata ) ;
38
38
39
39
this . metadataComponent = new MetadataComponent ( {
@@ -141,5 +141,18 @@ export class MoreInfoRightPanel extends RightPanel<MoreInfoRightPanelConfig> {
141
141
this . $main . height (
142
142
this . $element . height ( ) - this . $top . height ( ) - this . $main . verticalMargins ( )
143
143
) ;
144
+
145
+ // always put tabindex on, so the main is focusable,
146
+ // just in case there's something wrong with the height
147
+ // comparison below
148
+ this . $main . attr ( 'tabindex' , 0 ) ;
149
+ this . $main . attr ( 'aria-label' , this . config . content . title ) ;
150
+
151
+ // if metadata's height lte main's, no scroll, so no focus needed
152
+ // and no aria label either
153
+ if ( this . $metadata . height ( ) <= this . $main . height ( ) ) {
154
+ this . $main . removeAttr ( 'tabindex' ) ;
155
+ this . $main . removeAttr ( 'aria-label' ) ;
156
+ }
144
157
}
145
158
}
You can’t perform that action at this time.
0 commit comments