@@ -14,7 +14,7 @@ Distributed under the terms of the Open Source Initiative OSI - MIT License
14
14
window [ nameSpace ] = { } ;
15
15
nameSpace = window [ nameSpace ] ;
16
16
}
17
- nameSpace . getAccNameVersion = "2.57 " ;
17
+ nameSpace . getAccNameVersion = "2.58 " ;
18
18
// AccName Computation Prototype
19
19
nameSpace . getAccName = nameSpace . calcNames = function (
20
20
node ,
@@ -34,7 +34,11 @@ Distributed under the terms of the Open Source Initiative OSI - MIT License
34
34
var rootNode = node ;
35
35
var rootRole = trim ( node . getAttribute ( "role" ) || "" ) ;
36
36
// Track nodes to prevent duplicate node reference parsing.
37
- var nodes = [ ] ;
37
+ // Separating Name and Description to prevent duplicate node references from suppressing one or the other from being fully computed.
38
+ var nodes = {
39
+ name : [ ] ,
40
+ desc : [ ]
41
+ } ;
38
42
// Track aria-owns references to prevent duplicate parsing.
39
43
var owns = [ ] ;
40
44
@@ -147,7 +151,12 @@ Plus roles extended for the Role Parity project.
147
151
after : ""
148
152
} ;
149
153
150
- if ( ! skipTo . tag && ! skipTo . role && nodes . indexOf ( refNode ) === - 1 ) {
154
+ if (
155
+ ! skipTo . tag &&
156
+ ! skipTo . role &&
157
+ nodes [ ! ownedBy . computingDesc ? "name" : "desc" ] . indexOf ( refNode ) ===
158
+ - 1
159
+ ) {
151
160
// Store the before and after pseudo element 'content' values for the top level DOM node
152
161
// Note: If the pseudo element includes block level styling, a space will be added, otherwise inline is asumed and no spacing is added.
153
162
cssOP = getCSSText ( refNode , null ) ;
@@ -273,8 +282,13 @@ Plus roles extended for the Role Parity project.
273
282
return result ;
274
283
}
275
284
276
- if ( ! skipTo . tag && ! skipTo . role && nodes . indexOf ( node ) === - 1 ) {
277
- nodes . push ( node ) ;
285
+ if (
286
+ ! skipTo . tag &&
287
+ ! skipTo . role &&
288
+ nodes [ ! ownedBy . computingDesc ? "name" : "desc" ] . indexOf ( node ) ===
289
+ - 1
290
+ ) {
291
+ nodes [ ! ownedBy . computingDesc ? "name" : "desc" ] . push ( node ) ;
278
292
} else {
279
293
// Abort if this node has already been processed.
280
294
return result ;
@@ -291,8 +305,14 @@ Plus roles extended for the Role Parity project.
291
305
} ;
292
306
293
307
var parent = refNode === node ? node : node . parentNode ;
294
- if ( ! skipTo . tag && ! skipTo . role && nodes . indexOf ( parent ) === - 1 ) {
295
- nodes . push ( parent ) ;
308
+ if (
309
+ ! skipTo . tag &&
310
+ ! skipTo . role &&
311
+ nodes [ ! ownedBy . computingDesc ? "name" : "desc" ] . indexOf (
312
+ parent
313
+ ) === - 1
314
+ ) {
315
+ nodes [ ! ownedBy . computingDesc ? "name" : "desc" ] . push ( parent ) ;
296
316
// Store the before and after pseudo element 'content' values for the current node container element
297
317
// Note: If the pseudo element includes block level styling, a space will be added, otherwise inline is asumed and no spacing is added.
298
318
cssO = getCSSText ( parent , refNode ) ;
@@ -416,7 +436,8 @@ Plus roles extended for the Role Parity project.
416
436
parts . push (
417
437
walk ( element , true , false , [ node ] , false , {
418
438
ref : ownedBy ,
419
- top : element
439
+ top : element ,
440
+ computingDesc : true
420
441
} ) . name
421
442
) ;
422
443
}
@@ -1527,18 +1548,21 @@ Plus roles extended for the Role Parity project.
1527
1548
var accName = trim ( accProps . name . replace ( / \s + / g, " " ) ) ;
1528
1549
var accDesc = trim ( accProps . title . replace ( / \s + / g, " " ) ) ;
1529
1550
1530
- if ( accName === accDesc ) {
1531
- // If both Name and Description properties match, then clear the Description property value.
1532
- accDesc = "" ;
1533
- }
1551
+ // if (accName === accDesc) {
1552
+ // If both Name and Description properties match, then clear the Description property value. (Ideal but not in the spec so commented out.)
1553
+ // accDesc = "";
1554
+ // }
1534
1555
1535
1556
props . hasUpperCase =
1536
1557
rootRole && rootRole !== rootRole . toLowerCase ( ) ? true : false ;
1537
1558
props . name = accName ;
1538
1559
props . desc = accDesc ;
1539
1560
1540
1561
// Clear track variables
1541
- nodes = [ ] ;
1562
+ nodes = {
1563
+ name : [ ] ,
1564
+ desc : [ ]
1565
+ } ;
1542
1566
owns = [ ] ;
1543
1567
} catch ( e ) {
1544
1568
props . error = e ;
0 commit comments