@@ -4,10 +4,14 @@ import slideDown from "@ui5/webcomponents-base/dist/animations/slideDown.js";
4
4
import slideUp from "@ui5/webcomponents-base/dist/animations/slideUp.js" ;
5
5
import { isSpace , isEnter } from "@ui5/webcomponents-base/dist/Keys.js" ;
6
6
import AnimationMode from "@ui5/webcomponents-base/dist/types/AnimationMode.js" ;
7
- import getEffectiveAriaLabelText from "@ui5/webcomponents-base/dist/util/getEffectiveAriaLabelText.js" ;
7
+ import {
8
+ getEffectiveAriaLabelText ,
9
+ getAriaLabelledByTexts ,
10
+ } from "@ui5/webcomponents-base/dist/util/AriaLabelHelper.js" ;
8
11
import { getAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationMode.js" ;
9
12
import { fetchI18nBundle , getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js" ;
10
13
import "@ui5/webcomponents-icons/dist/icons/slim-arrow-right.js" ;
14
+ import findNodeOwner from "@ui5/webcomponents-base/dist/util/findNodeOwner.js" ;
11
15
import Button from "./Button.js" ;
12
16
import TitleLevel from "./types/TitleLevel.js" ;
13
17
import PanelAccessibleRole from "./types/PanelAccessibleRole.js" ;
@@ -118,6 +122,7 @@ const metadata = {
118
122
type : TitleLevel ,
119
123
defaultValue : TitleLevel . H2 ,
120
124
} ,
125
+
121
126
/**
122
127
* @type {String }
123
128
* @defaultvalue ""
@@ -127,6 +132,7 @@ const metadata = {
127
132
ariaLabel : {
128
133
type : String ,
129
134
} ,
135
+
130
136
/**
131
137
* Receives id(or many ids) of the elements that label the panel
132
138
*
@@ -139,23 +145,40 @@ const metadata = {
139
145
type : String ,
140
146
defaultValue : "" ,
141
147
} ,
148
+
149
+ /**
150
+ * Receives id(or many ids) of the elements that label the header of the panel
151
+ *
152
+ * @type {String }
153
+ * @defaultvalue ""
154
+ * @private
155
+ * @since 1.0.0-rc.9
156
+ */
157
+ headerAriaLabelledby : {
158
+ type : String ,
159
+ } ,
160
+
142
161
/**
143
162
* @private
144
163
*/
145
164
_hasHeader : {
146
165
type : Boolean ,
147
166
} ,
167
+
148
168
_header : {
149
169
type : Object ,
150
170
} ,
171
+
151
172
_contentExpanded : {
152
173
type : Boolean ,
153
174
noAttribute : true ,
154
175
} ,
176
+
155
177
_animationRunning : {
156
178
type : Boolean ,
157
179
noAttribute : true ,
158
180
} ,
181
+
159
182
_buttonAccInfo : {
160
183
type : Object ,
161
184
} ,
@@ -396,6 +419,10 @@ class Panel extends UI5Element {
396
419
return getEffectiveAriaLabelText ( this ) ;
397
420
}
398
421
422
+ get header ( ) {
423
+ return this . getDomRef ( ) . querySelector ( `#${ this . _id } -header-title` ) ;
424
+ }
425
+
399
426
get headerAriaLevel ( ) {
400
427
return this . headerLevel . slice ( 1 ) ;
401
428
}
@@ -404,6 +431,13 @@ class Panel extends UI5Element {
404
431
return ( this . header . length || this . fixed ) ? "-1" : "0" ;
405
432
}
406
433
434
+ get headerAriaLabelledByText ( ) {
435
+ if ( ! this . headerAriaLabelledby ) {
436
+ return ;
437
+ }
438
+ return getAriaLabelledByTexts ( this . header , findNodeOwner ( this ) , this . headerAriaLabelledby ) ;
439
+ }
440
+
407
441
get nonFixedInternalHeader ( ) {
408
442
return ! this . _hasHeader && ! this . fixed ;
409
443
}
0 commit comments