@@ -19,7 +19,7 @@ export var FeatureIndex = L.Layer.extend({
1919
2020 this . _output = L . DomUtil . create ( "output" , "mapml-feature-index" , map . _container ) ;
2121 this . _body = L . DomUtil . create ( "span" , "mapml-feature-index-content" , this . _output ) ;
22- this . _moreContent = L . DomUtil . create ( "span" , "mapml-feature-index-content more-content" , this . _output ) ;
22+ this . _moreContent = L . DomUtil . create ( "span" , "mapml-feature-index-more-content" , this . _output ) ;
2323 this . _moreContent . style . display = "none" ;
2424
2525 map . on ( "layerchange layeradd layerremove overlayremove" , this . _toggleEvents , this ) ;
@@ -54,13 +54,21 @@ export var FeatureIndex = L.Layer.extend({
5454 keys . forEach ( i => {
5555 if ( layers [ i ] . featureAttributes && featureIndexBounds . overlaps ( layers [ i ] . _bounds ) ) {
5656 let label = layers [ i ] . group . getAttribute ( "aria-label" ) ;
57- if ( index === 9 ) {
58- body . appendChild ( this . _updateOutput ( "More results" , 9 ) ) ;
59- index += 1 ;
57+
58+ if ( index % 9 === 0 ) {
59+ let span = document . createElement ( "span" ) ;
60+ span . setAttribute ( "id" , index / 9 ) ;
61+ moreContent . appendChild ( span ) ;
62+ if ( index === 9 ) {
63+ body . appendChild ( this . _updateOutput ( "More results" , 9 ) ) ;
64+ index += 1 ;
65+ }
6066 }
6167
6268 if ( index > 9 ) {
63- moreContent . appendChild ( this . _updateOutput ( label , index ) ) ;
69+ let value = Math . floor ( ( index - 1 ) / 9 ) ;
70+ let span = moreContent . querySelector ( `[id=${ CSS . escape ( value ) } ]` ) ;
71+ span . appendChild ( this . _updateOutput ( label , index ) ) ;
6472 } else {
6573 body . appendChild ( this . _updateOutput ( label , index ) ) ;
6674 }
0 commit comments