@@ -64,9 +64,6 @@ var MoreList = React.createClass({
64
64
allowShowAll : false ,
65
65
showCount : true
66
66
} ;
67
- } ,
68
- generateMessage : function ( increment ) {
69
-
70
67
} ,
71
68
addMoreComponent : function ( ) {
72
69
var children = this . props . children ;
@@ -80,7 +77,7 @@ var MoreList = React.createClass({
80
77
81
78
if ( this . props . moreSize === 0 ) {
82
79
var count = this . props . showCount ? < span className = "ml-count ml-more-count" > { remaining } </ span > : null ;
83
- return ( < li aria-label = { message } role = "button" className = "ml-list-item ml-expander ml-more" onMouseDown = { this . increaseItemsShown . bind ( this , remaining ) } > More... { count } </ li > ) ;
80
+ return ( < li aria-label = { message } aria-controls = { this . props . id } role = "button" className = "ml-list-item ml-expander ml-more" onMouseDown = { this . increaseItemsShown . bind ( this , remaining ) } > More... { count } </ li > ) ;
84
81
}
85
82
86
83
var toAdd = remaining <= this . props . moreSize ? remaining : this . props . moreSize ;
@@ -94,7 +91,7 @@ var MoreList = React.createClass({
94
91
message = "Click to show " + toAdd + " more items" ;
95
92
}
96
93
97
- return ( < li aria-label = { message } role = "button" className = "ml-list-item ml-expander ml-more" onMouseDown = { this . increaseItemsShown . bind ( this , toAdd ) } > More... { count } </ li > ) ;
94
+ return ( < li aria-label = { message } aria-controls = { this . props . id } role = "button" className = "ml-list-item ml-expander ml-more" onMouseDown = { this . increaseItemsShown . bind ( this , toAdd ) } > More... { count } </ li > ) ;
98
95
} ,
99
96
addShowAllComponent : function ( ) {
100
97
if ( ! this . props . allowShowAll || this . props . moreSize == 0 ) {
@@ -111,7 +108,7 @@ var MoreList = React.createClass({
111
108
var message = "Click to show all " + remaining + " remaining items" ;
112
109
113
110
var count = this . props . showCount ? < span className = "ml-count ml-show-all-count" > { remaining } </ span > : null ;
114
- return ( < li aria-label = { message } role = "button" className = "ml-list-item ml-expander ml-show-all" onMouseDown = { this . increaseItemsShown . bind ( this , remaining ) } > Show All... { count } </ li > ) ;
111
+ return ( < li aria-label = { message } aria-controls = { this . props . id } role = "button" className = "ml-list-item ml-expander ml-show-all" onMouseDown = { this . increaseItemsShown . bind ( this , remaining ) } > Show All... { count } </ li > ) ;
115
112
} ,
116
113
render : function ( )
117
114
{
@@ -124,21 +121,21 @@ var MoreList = React.createClass({
124
121
var shownItemCount = this . state . itemsShown ;
125
122
shownItemCount += shownItemCount + this . props . tolerance >= children . length ? this . props . tolerance : 0 ;
126
123
127
- var listItems = children . slice ( 0 , shownItemCount ) . map ( function ( child ) {
124
+ var listItems = children . slice ( 0 , shownItemCount ) . map ( function ( child , id ) {
128
125
var className = "ml-list-item ml-data"
129
126
130
127
if ( child . props . className ) {
131
128
className = className + " " + child . props . className ;
132
129
}
133
130
134
- return React . addons . cloneWithProps ( child , { className : className } )
131
+ return React . addons . cloneWithProps ( child , { className : className , ref : "li" + id } )
135
132
} ) ;
136
133
137
134
listItems . push ( this . addMoreComponent ( ) ) ;
138
135
listItems . push ( this . addShowAllComponent ( ) ) ;
139
136
140
137
return (
141
- < ul className = "ml-list" >
138
+ < ul aria-live = "assertive" className = "ml-list" >
142
139
{ listItems }
143
140
</ ul >
144
141
)
0 commit comments