[{"data":1,"prerenderedAt":2691},["ShallowReactive",2],{"navigation_docs":3,"-guides-accessibility":107,"-guides-accessibility-surround":2686},[4,26,57,87,97],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":25},"Getting Started","i-lucide-rocket","\u002Fgetting-started","1.getting-started",[10,15,20],{"title":11,"path":12,"stem":13,"icon":14},"Introduction","\u002Fgetting-started\u002Fintroduction","1.getting-started\u002F1.introduction","i-lucide-book-open",{"title":16,"path":17,"stem":18,"icon":19},"Installation","\u002Fgetting-started\u002Finstallation","1.getting-started\u002F2.installation","i-lucide-download",{"title":21,"path":22,"stem":23,"icon":24},"Architecture","\u002Fgetting-started\u002Farchitecture","1.getting-started\u002F3.architecture","i-lucide-workflow",false,{"title":27,"icon":28,"path":29,"stem":30,"children":31,"page":25},"Reference","i-lucide-layers","\u002Freference","2.reference",[32,37,42,47,52],{"title":33,"path":34,"stem":35,"icon":36},"VirtualGrid","\u002Freference\u002Fvirtual-grid","2.reference\u002F1.virtual-grid","i-lucide-table-2",{"title":38,"path":39,"stem":40,"icon":41},"Primitives","\u002Freference\u002Fprimitives","2.reference\u002F2.primitives","i-lucide-crosshair",{"title":43,"path":44,"stem":45,"icon":46},"Utilities","\u002Freference\u002Futilities","2.reference\u002F3.utilities","i-lucide-wrench",{"title":48,"path":49,"stem":50,"icon":51},"Benchmarks","\u002Freference\u002Fbenchmarks","2.reference\u002F4.benchmarks","i-lucide-timer",{"title":53,"path":54,"stem":55,"icon":56},"ARIA patterns","\u002Freference\u002Faria-patterns","2.reference\u002F6.aria-patterns","i-lucide-accessibility",{"title":58,"icon":59,"path":60,"stem":61,"children":62,"page":25},"Guides","i-lucide-compass","\u002Fguides","3.guides",[63,67,72,77,82],{"title":64,"path":65,"stem":66,"icon":56},"Accessibility","\u002Fguides\u002Faccessibility","3.guides\u002F1.accessibility",{"title":68,"path":69,"stem":70,"icon":71},"Popovers and overlays","\u002Fguides\u002Fpopovers","3.guides\u002F2.popovers","i-lucide-message-square",{"title":73,"path":74,"stem":75,"icon":76},"Floating UI","\u002Fguides\u002Ffloating-ui","3.guides\u002F3.floating-ui","i-lucide-layers-2",{"title":78,"path":79,"stem":80,"icon":81},"Sizing and direction","\u002Fguides\u002Fsizing-and-direction","3.guides\u002F4.sizing-and-direction","i-lucide-move",{"title":83,"path":84,"stem":85,"icon":86},"Performance","\u002Fguides\u002Fperformance","3.guides\u002F5.performance","i-lucide-gauge",{"title":88,"icon":89,"path":90,"stem":91,"children":92,"page":25},"Examples","i-lucide-flask-conical","\u002Fexamples","4.examples",[93],{"title":94,"path":95,"stem":96,"icon":56},"ARIA examples","\u002Fexamples\u002Faria","4.examples\u002F1.aria",{"title":98,"icon":99,"path":100,"stem":101,"children":102,"page":25},"Changes","i-lucide-history","\u002Fchanges","5.changes",[103],{"title":104,"path":105,"stem":106,"icon":99},"Changelog","\u002Fchanges\u002Fchangelog","5.changes\u002F1.changelog",{"id":108,"title":64,"body":109,"description":2679,"extension":2680,"links":2681,"meta":2682,"navigation":2683,"path":65,"seo":2684,"stem":66,"__hash__":2685},"docs\u002F3.guides\u002F1.accessibility.md",{"type":110,"value":111,"toc":2670},"minimark",[112,116,119,135,2667],[113,114,115],"p",{},"This guide builds a grid that a screen reader announces as \"item 4,200 of 10,000\", and that keyboard users can move through with the arrow keys.",[113,117,118],{},"A list of 10,000 items keeps only a few hundred of them in the DOM, so a screen reader that counts elements reports a few hundred items. The grid does not add ARIA roles or focus handling. Instead, it gives you each item's index and the primitives to compute its row and column, so you can add both yourself.",[113,120,121,122,125,126,130,131,134],{},"The ",[123,124,53],"a",{"href":54}," reference explains why this guide uses ",[127,128,129],"code",{},"list"," and ",[127,132,133],{},"listitem",", and which other roles fit the grid.",[136,137,138,143,149,353,379,662,675,679,698,848,852,872,1010,1016,1020,1023,1037,1053,1315,1329,1338,1342,1356,1366,1389,1406,1833,1855,1859,1867,1878,2383,2389,2411,2420,2634,2638,2648,2661],"steps",{},[139,140,142],"h3",{"id":141},"add-list-roles","Add list roles",[113,144,145,146,148],{},"The samples in this guide use a list of 10,000 items held in memory. The grid uses the scroll container, column tracks and probe from ",[123,147,78],{"href":79},".",[150,151,156],"pre",{"className":152,"code":153,"language":154,"meta":155,"style":155},"language-vue shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u003Cscript setup lang=\"ts\">\nimport { createPageProvider } from \"vvirtual-grid\u002Fvue\";\n\nconst items = Array.from({ length: 10000 }, (_, i) => ({ title: `Item ${i + 1}` }));\nconst pageProvider = createPageProvider(items);\n\u003C\u002Fscript>\n","vue","",[127,157,158,193,224,231,326,343],{"__ignoreMap":155},[159,160,163,167,171,175,178,181,184,188,190],"span",{"class":161,"line":162},"line",1,[159,164,166],{"class":165},"sMK4o","\u003C",[159,168,170],{"class":169},"swJcz","script",[159,172,174],{"class":173},"spNyl"," setup",[159,176,177],{"class":173}," lang",[159,179,180],{"class":165},"=",[159,182,183],{"class":165},"\"",[159,185,187],{"class":186},"sfazB","ts",[159,189,183],{"class":165},[159,191,192],{"class":165},">\n",[159,194,196,200,203,207,210,213,216,219,221],{"class":161,"line":195},2,[159,197,199],{"class":198},"s7zQu","import",[159,201,202],{"class":165}," {",[159,204,206],{"class":205},"sTEyZ"," createPageProvider",[159,208,209],{"class":165}," }",[159,211,212],{"class":198}," from",[159,214,215],{"class":165}," \"",[159,217,218],{"class":186},"vvirtual-grid\u002Fvue",[159,220,183],{"class":165},[159,222,223],{"class":165},";\n",[159,225,227],{"class":161,"line":226},3,[159,228,230],{"emptyLinePlaceholder":229},true,"\n",[159,232,234,237,240,242,245,247,251,254,257,260,263,267,270,273,277,280,283,286,289,291,293,296,298,301,304,307,310,313,316,319,321,324],{"class":161,"line":233},4,[159,235,236],{"class":173},"const",[159,238,239],{"class":205}," items ",[159,241,180],{"class":165},[159,243,244],{"class":205}," Array",[159,246,148],{"class":165},[159,248,250],{"class":249},"s2Zo4","from",[159,252,253],{"class":205},"(",[159,255,256],{"class":165},"{",[159,258,259],{"class":169}," length",[159,261,262],{"class":165},":",[159,264,266],{"class":265},"sbssI"," 10000",[159,268,269],{"class":165}," },",[159,271,272],{"class":165}," (",[159,274,276],{"class":275},"sHdIc","_",[159,278,279],{"class":165},",",[159,281,282],{"class":275}," i",[159,284,285],{"class":165},")",[159,287,288],{"class":173}," =>",[159,290,272],{"class":205},[159,292,256],{"class":165},[159,294,295],{"class":169}," title",[159,297,262],{"class":165},[159,299,300],{"class":165}," `",[159,302,303],{"class":186},"Item ",[159,305,306],{"class":165},"${",[159,308,309],{"class":205},"i ",[159,311,312],{"class":165},"+",[159,314,315],{"class":265}," 1",[159,317,318],{"class":165},"}`",[159,320,209],{"class":165},[159,322,323],{"class":205},"))",[159,325,223],{"class":165},[159,327,329,331,334,336,338,341],{"class":161,"line":328},5,[159,330,236],{"class":173},[159,332,333],{"class":205}," pageProvider ",[159,335,180],{"class":165},[159,337,206],{"class":249},[159,339,340],{"class":205},"(items)",[159,342,223],{"class":165},[159,344,346,349,351],{"class":161,"line":345},6,[159,347,348],{"class":165},"\u003C\u002F",[159,350,170],{"class":169},[159,352,192],{"class":165},[113,354,355,356,359,360,363,364,130,367,370,371,374,375,378],{},"Add ",[127,357,358],{},"role=\"list\""," to ",[127,361,362],{},"\u003CVirtualGrid>",", ",[127,365,366],{},"role=\"listitem\"",[127,368,369],{},":data-index=\"index\""," to the root element of the ",[127,372,373],{},"default"," slot. The ",[127,376,377],{},"data-index"," attribute lets the focus step find the item's element. The probe slot has no role, because the grid hides it and a screen reader never announces it.",[150,380,382],{"className":152,"code":381,"language":154,"meta":155,"style":155},"\u003Ctemplate>\n  \u003Cdiv class=\"h-96 overflow-y-auto\">\n    \u003CVirtualGrid\n      role=\"list\"\n      :length=\"items.length\"\n      :page-size=\"40\"\n      :page-provider=\"pageProvider\"\n      class=\"grid grid-cols-[repeat(auto-fill,minmax(120px,1fr))] gap-2\"\n    >\n      \u003Ctemplate #default=\"{ item, index, style }\">\n        \u003Cdiv :style=\"style\" :data-index=\"index\" role=\"listitem\" class=\"h-16\">\n          {{ item.title }}\n        \u003C\u002Fdiv>\n      \u003C\u002Ftemplate>\n    \u003C\u002FVirtualGrid>\n  \u003C\u002Fdiv>\n\u003C\u002Ftemplate>\n",[127,383,384,393,415,423,437,458,474,491,506,512,551,607,613,623,633,643,653],{"__ignoreMap":155},[159,385,386,388,391],{"class":161,"line":162},[159,387,166],{"class":165},[159,389,390],{"class":169},"template",[159,392,192],{"class":165},[159,394,395,398,401,404,406,408,411,413],{"class":161,"line":195},[159,396,397],{"class":165},"  \u003C",[159,399,400],{"class":169},"div",[159,402,403],{"class":173}," class",[159,405,180],{"class":165},[159,407,183],{"class":165},[159,409,410],{"class":186},"h-96 overflow-y-auto",[159,412,183],{"class":165},[159,414,192],{"class":165},[159,416,417,420],{"class":161,"line":226},[159,418,419],{"class":165},"    \u003C",[159,421,422],{"class":169},"VirtualGrid\n",[159,424,425,428,430,432,434],{"class":161,"line":233},[159,426,427],{"class":173},"      role",[159,429,180],{"class":165},[159,431,183],{"class":165},[159,433,129],{"class":186},[159,435,436],{"class":165},"\"\n",[159,438,439,442,445,447,449,452,454,456],{"class":161,"line":328},[159,440,441],{"class":165},"      :",[159,443,444],{"class":173},"length",[159,446,180],{"class":165},[159,448,183],{"class":165},[159,450,451],{"class":205},"items",[159,453,148],{"class":165},[159,455,444],{"class":205},[159,457,436],{"class":165},[159,459,460,462,465,467,469,472],{"class":161,"line":345},[159,461,441],{"class":165},[159,463,464],{"class":173},"page-size",[159,466,180],{"class":165},[159,468,183],{"class":165},[159,470,471],{"class":265},"40",[159,473,436],{"class":165},[159,475,477,479,482,484,486,489],{"class":161,"line":476},7,[159,478,441],{"class":165},[159,480,481],{"class":173},"page-provider",[159,483,180],{"class":165},[159,485,183],{"class":165},[159,487,488],{"class":205},"pageProvider",[159,490,436],{"class":165},[159,492,494,497,499,501,504],{"class":161,"line":493},8,[159,495,496],{"class":173},"      class",[159,498,180],{"class":165},[159,500,183],{"class":165},[159,502,503],{"class":186},"grid grid-cols-[repeat(auto-fill,minmax(120px,1fr))] gap-2",[159,505,436],{"class":165},[159,507,509],{"class":161,"line":508},9,[159,510,511],{"class":165},"    >\n",[159,513,515,518,520,523,525,527,529,531,534,536,539,541,544,547,549],{"class":161,"line":514},10,[159,516,517],{"class":165},"      \u003C",[159,519,390],{"class":169},[159,521,522],{"class":165}," #",[159,524,373],{"class":173},[159,526,180],{"class":165},[159,528,183],{"class":165},[159,530,256],{"class":165},[159,532,533],{"class":205}," item",[159,535,279],{"class":165},[159,537,538],{"class":205}," index",[159,540,279],{"class":165},[159,542,543],{"class":205}," style ",[159,545,546],{"class":165},"}",[159,548,183],{"class":165},[159,550,192],{"class":165},[159,552,554,557,559,562,564,566,569,571,574,576,578,581,583,586,588,590,592,594,596,598,600,603,605],{"class":161,"line":553},11,[159,555,556],{"class":165},"        \u003C",[159,558,400],{"class":169},[159,560,561],{"class":173}," :style",[159,563,180],{"class":165},[159,565,183],{"class":165},[159,567,568],{"class":186},"style",[159,570,183],{"class":165},[159,572,573],{"class":173}," :data-index",[159,575,180],{"class":165},[159,577,183],{"class":165},[159,579,580],{"class":186},"index",[159,582,183],{"class":165},[159,584,585],{"class":173}," role",[159,587,180],{"class":165},[159,589,183],{"class":165},[159,591,133],{"class":186},[159,593,183],{"class":165},[159,595,403],{"class":173},[159,597,180],{"class":165},[159,599,183],{"class":165},[159,601,602],{"class":186},"h-16",[159,604,183],{"class":165},[159,606,192],{"class":165},[159,608,610],{"class":161,"line":609},12,[159,611,612],{"class":205},"          {{ item.title }}\n",[159,614,616,619,621],{"class":161,"line":615},13,[159,617,618],{"class":165},"        \u003C\u002F",[159,620,400],{"class":169},[159,622,192],{"class":165},[159,624,626,629,631],{"class":161,"line":625},14,[159,627,628],{"class":165},"      \u003C\u002F",[159,630,390],{"class":169},[159,632,192],{"class":165},[159,634,636,639,641],{"class":161,"line":635},15,[159,637,638],{"class":165},"    \u003C\u002F",[159,640,33],{"class":169},[159,642,192],{"class":165},[159,644,646,649,651],{"class":161,"line":645},16,[159,647,648],{"class":165},"  \u003C\u002F",[159,650,400],{"class":169},[159,652,192],{"class":165},[159,654,656,658,660],{"class":161,"line":655},17,[159,657,348],{"class":165},[159,659,390],{"class":169},[159,661,192],{"class":165},[113,663,664,665,667,668,671,672,674],{},"The scroll container is the ",[127,666,400],{},". Do not set ",[127,669,670],{},"overflow"," or a height on ",[127,673,362],{}," itself. The grid sets its own height when it computes the layout, and that overrides any height you set.",[139,676,678],{"id":677},"set-the-size-and-position-of-each-item","Set the size and position of each item",[113,680,355,681,684,685,688,689,691,692,694,695,697],{},[127,682,683],{},"aria-setsize"," with the number of items in the list and ",[127,686,687],{},"aria-posinset"," with the item's position to the root element of the ",[127,690,373],{}," slot. ",[127,693,687],{}," counts from 1 and ",[127,696,580],{}," counts from 0, so add 1.",[150,699,701],{"className":152,"code":700,"language":154,"meta":155,"style":155},"\u003Ctemplate #default=\"{ item, index, style }\">\n  \u003Cdiv\n    :style=\"style\"\n    :data-index=\"index\"\n    role=\"listitem\"\n    :aria-setsize=\"items.length\"\n    :aria-posinset=\"index + 1\"\n    class=\"h-16\"\n  >\n    {{ item.title }}\n  \u003C\u002Fdiv>\n\u003C\u002Ftemplate>\n",[127,702,703,735,742,755,768,781,795,809,822,827,832,840],{"__ignoreMap":155},[159,704,705,707,709,711,713,715,717,719,721,723,725,727,729,731,733],{"class":161,"line":162},[159,706,166],{"class":165},[159,708,390],{"class":169},[159,710,522],{"class":165},[159,712,373],{"class":173},[159,714,180],{"class":165},[159,716,183],{"class":165},[159,718,256],{"class":165},[159,720,533],{"class":205},[159,722,279],{"class":165},[159,724,538],{"class":205},[159,726,279],{"class":165},[159,728,543],{"class":205},[159,730,546],{"class":165},[159,732,183],{"class":165},[159,734,192],{"class":165},[159,736,737,739],{"class":161,"line":195},[159,738,397],{"class":165},[159,740,741],{"class":169},"div\n",[159,743,744,747,749,751,753],{"class":161,"line":226},[159,745,746],{"class":173},"    :style",[159,748,180],{"class":165},[159,750,183],{"class":165},[159,752,568],{"class":186},[159,754,436],{"class":165},[159,756,757,760,762,764,766],{"class":161,"line":233},[159,758,759],{"class":173},"    :data-index",[159,761,180],{"class":165},[159,763,183],{"class":165},[159,765,580],{"class":186},[159,767,436],{"class":165},[159,769,770,773,775,777,779],{"class":161,"line":328},[159,771,772],{"class":173},"    role",[159,774,180],{"class":165},[159,776,183],{"class":165},[159,778,133],{"class":186},[159,780,436],{"class":165},[159,782,783,786,788,790,793],{"class":161,"line":345},[159,784,785],{"class":173},"    :aria-setsize",[159,787,180],{"class":165},[159,789,183],{"class":165},[159,791,792],{"class":186},"items.length",[159,794,436],{"class":165},[159,796,797,800,802,804,807],{"class":161,"line":476},[159,798,799],{"class":173},"    :aria-posinset",[159,801,180],{"class":165},[159,803,183],{"class":165},[159,805,806],{"class":186},"index + 1",[159,808,436],{"class":165},[159,810,811,814,816,818,820],{"class":161,"line":493},[159,812,813],{"class":173},"    class",[159,815,180],{"class":165},[159,817,183],{"class":165},[159,819,602],{"class":186},[159,821,436],{"class":165},[159,823,824],{"class":161,"line":508},[159,825,826],{"class":165},"  >\n",[159,828,829],{"class":161,"line":514},[159,830,831],{"class":205},"    {{ item.title }}\n",[159,833,834,836,838],{"class":161,"line":553},[159,835,648],{"class":165},[159,837,400],{"class":169},[159,839,192],{"class":165},[159,841,842,844,846],{"class":161,"line":609},[159,843,348],{"class":165},[159,845,390],{"class":169},[159,847,192],{"class":165},[139,849,851],{"id":850},"mark-placeholders-as-busy","Mark placeholders as busy",[113,853,854,855,858,859,130,861,863,864,867,868,871],{},"Add the ",[127,856,857],{},"placeholder"," slot with the same role, ",[127,860,683],{},[127,862,687],{}," as the default slot, and add ",[127,865,866],{},"aria-busy=\"true\"",". A placeholder has no content yet, and ",[127,869,870],{},"aria-busy"," tells the screen reader the content is still loading.",[150,873,875],{"className":152,"code":874,"language":154,"meta":155,"style":155},"\u003Ctemplate #placeholder=\"{ index, style }\">\n  \u003Cdiv\n    :style=\"style\"\n    :data-index=\"index\"\n    role=\"listitem\"\n    aria-busy=\"true\"\n    :aria-setsize=\"items.length\"\n    :aria-posinset=\"index + 1\"\n    class=\"h-16\"\n  \u002F>\n\u003C\u002Ftemplate>\n",[127,876,877,905,911,923,935,947,961,973,985,997,1002],{"__ignoreMap":155},[159,878,879,881,883,885,887,889,891,893,895,897,899,901,903],{"class":161,"line":162},[159,880,166],{"class":165},[159,882,390],{"class":169},[159,884,522],{"class":165},[159,886,857],{"class":173},[159,888,180],{"class":165},[159,890,183],{"class":165},[159,892,256],{"class":165},[159,894,538],{"class":205},[159,896,279],{"class":165},[159,898,543],{"class":205},[159,900,546],{"class":165},[159,902,183],{"class":165},[159,904,192],{"class":165},[159,906,907,909],{"class":161,"line":195},[159,908,397],{"class":165},[159,910,741],{"class":169},[159,912,913,915,917,919,921],{"class":161,"line":226},[159,914,746],{"class":173},[159,916,180],{"class":165},[159,918,183],{"class":165},[159,920,568],{"class":186},[159,922,436],{"class":165},[159,924,925,927,929,931,933],{"class":161,"line":233},[159,926,759],{"class":173},[159,928,180],{"class":165},[159,930,183],{"class":165},[159,932,580],{"class":186},[159,934,436],{"class":165},[159,936,937,939,941,943,945],{"class":161,"line":328},[159,938,772],{"class":173},[159,940,180],{"class":165},[159,942,183],{"class":165},[159,944,133],{"class":186},[159,946,436],{"class":165},[159,948,949,952,954,956,959],{"class":161,"line":345},[159,950,951],{"class":173},"    aria-busy",[159,953,180],{"class":165},[159,955,183],{"class":165},[159,957,958],{"class":186},"true",[159,960,436],{"class":165},[159,962,963,965,967,969,971],{"class":161,"line":476},[159,964,785],{"class":173},[159,966,180],{"class":165},[159,968,183],{"class":165},[159,970,792],{"class":186},[159,972,436],{"class":165},[159,974,975,977,979,981,983],{"class":161,"line":493},[159,976,799],{"class":173},[159,978,180],{"class":165},[159,980,183],{"class":165},[159,982,806],{"class":186},[159,984,436],{"class":165},[159,986,987,989,991,993,995],{"class":161,"line":508},[159,988,813],{"class":173},[159,990,180],{"class":165},[159,992,183],{"class":165},[159,994,602],{"class":186},[159,996,436],{"class":165},[159,998,999],{"class":161,"line":514},[159,1000,1001],{"class":165},"  \u002F>\n",[159,1003,1004,1006,1008],{"class":161,"line":553},[159,1005,348],{"class":165},[159,1007,390],{"class":169},[159,1009,192],{"class":165},[113,1011,1012,1013,1015],{},"A screen reader now announces the item at index 4199 as position 4,200 of 10,000, although only a few hundred items exist in the DOM. The exact wording varies by screen reader and browser. See ",[123,1014,94],{"href":95}," for a runnable version.",[139,1017,1019],{"id":1018},"keep-the-focused-index-in-a-ref","Keep the focused index in a ref",[113,1021,1022],{},"Store the index of the focused item in a ref, not the focused element. Items leave the DOM when the user scrolls away, so an element you stored would be removed.",[113,1024,1025,1026,1029,1030,1033,1034,1036],{},"Give ",[127,1027,1028],{},"tabindex=\"0\""," to the item whose index equals the ref, and ",[127,1031,1032],{},"tabindex=\"-1\""," to every other item. This pattern is called a roving tabindex. The Tab key reaches the one item with ",[127,1035,1028],{},", and your code moves the focus between items.",[113,1038,1039,1040,359,1043,1045,1046,1049,1050,1052],{},"Add the two refs to the script from the first step, add ",[127,1041,1042],{},"ref=\"grid\"",[127,1044,362],{},", and add the ",[127,1047,1048],{},"tabindex"," to the default slot. The placeholder slot gets no ",[127,1051,1048],{},", because a placeholder cannot take focus.",[150,1054,1056],{"className":152,"code":1055,"language":154,"meta":155,"style":155},"\u003Cscript setup lang=\"ts\">\nimport { ref, useTemplateRef } from \"vue\";\n\nconst grid = useTemplateRef(\"grid\");\nconst focused = ref(0);\n\u003C\u002Fscript>\n\n\u003Ctemplate #default=\"{ item, index, style }\">\n  \u003Cdiv\n    :style=\"style\"\n    :data-index=\"index\"\n    role=\"listitem\"\n    :tabindex=\"index === focused ? 0 : -1\"\n    :aria-setsize=\"items.length\"\n    :aria-posinset=\"index + 1\"\n    class=\"h-16\"\n  >\n    {{ item.title }}\n  \u003C\u002Fdiv>\n\u003C\u002Ftemplate>\n",[127,1057,1058,1078,1104,1108,1132,1152,1160,1164,1196,1202,1214,1226,1238,1252,1264,1276,1288,1292,1297,1306],{"__ignoreMap":155},[159,1059,1060,1062,1064,1066,1068,1070,1072,1074,1076],{"class":161,"line":162},[159,1061,166],{"class":165},[159,1063,170],{"class":169},[159,1065,174],{"class":173},[159,1067,177],{"class":173},[159,1069,180],{"class":165},[159,1071,183],{"class":165},[159,1073,187],{"class":186},[159,1075,183],{"class":165},[159,1077,192],{"class":165},[159,1079,1080,1082,1084,1087,1089,1092,1094,1096,1098,1100,1102],{"class":161,"line":195},[159,1081,199],{"class":198},[159,1083,202],{"class":165},[159,1085,1086],{"class":205}," ref",[159,1088,279],{"class":165},[159,1090,1091],{"class":205}," useTemplateRef",[159,1093,209],{"class":165},[159,1095,212],{"class":198},[159,1097,215],{"class":165},[159,1099,154],{"class":186},[159,1101,183],{"class":165},[159,1103,223],{"class":165},[159,1105,1106],{"class":161,"line":226},[159,1107,230],{"emptyLinePlaceholder":229},[159,1109,1110,1112,1115,1117,1119,1121,1123,1126,1128,1130],{"class":161,"line":233},[159,1111,236],{"class":173},[159,1113,1114],{"class":205}," grid ",[159,1116,180],{"class":165},[159,1118,1091],{"class":249},[159,1120,253],{"class":205},[159,1122,183],{"class":165},[159,1124,1125],{"class":186},"grid",[159,1127,183],{"class":165},[159,1129,285],{"class":205},[159,1131,223],{"class":165},[159,1133,1134,1136,1139,1141,1143,1145,1148,1150],{"class":161,"line":328},[159,1135,236],{"class":173},[159,1137,1138],{"class":205}," focused ",[159,1140,180],{"class":165},[159,1142,1086],{"class":249},[159,1144,253],{"class":205},[159,1146,1147],{"class":265},"0",[159,1149,285],{"class":205},[159,1151,223],{"class":165},[159,1153,1154,1156,1158],{"class":161,"line":345},[159,1155,348],{"class":165},[159,1157,170],{"class":169},[159,1159,192],{"class":165},[159,1161,1162],{"class":161,"line":476},[159,1163,230],{"emptyLinePlaceholder":229},[159,1165,1166,1168,1170,1172,1174,1176,1178,1180,1182,1184,1186,1188,1190,1192,1194],{"class":161,"line":493},[159,1167,166],{"class":165},[159,1169,390],{"class":169},[159,1171,522],{"class":165},[159,1173,373],{"class":173},[159,1175,180],{"class":165},[159,1177,183],{"class":165},[159,1179,256],{"class":165},[159,1181,533],{"class":205},[159,1183,279],{"class":165},[159,1185,538],{"class":205},[159,1187,279],{"class":165},[159,1189,543],{"class":205},[159,1191,546],{"class":165},[159,1193,183],{"class":165},[159,1195,192],{"class":165},[159,1197,1198,1200],{"class":161,"line":508},[159,1199,397],{"class":165},[159,1201,741],{"class":169},[159,1203,1204,1206,1208,1210,1212],{"class":161,"line":514},[159,1205,746],{"class":173},[159,1207,180],{"class":165},[159,1209,183],{"class":165},[159,1211,568],{"class":186},[159,1213,436],{"class":165},[159,1215,1216,1218,1220,1222,1224],{"class":161,"line":553},[159,1217,759],{"class":173},[159,1219,180],{"class":165},[159,1221,183],{"class":165},[159,1223,580],{"class":186},[159,1225,436],{"class":165},[159,1227,1228,1230,1232,1234,1236],{"class":161,"line":609},[159,1229,772],{"class":173},[159,1231,180],{"class":165},[159,1233,183],{"class":165},[159,1235,133],{"class":186},[159,1237,436],{"class":165},[159,1239,1240,1243,1245,1247,1250],{"class":161,"line":615},[159,1241,1242],{"class":173},"    :tabindex",[159,1244,180],{"class":165},[159,1246,183],{"class":165},[159,1248,1249],{"class":186},"index === focused ? 0 : -1",[159,1251,436],{"class":165},[159,1253,1254,1256,1258,1260,1262],{"class":161,"line":625},[159,1255,785],{"class":173},[159,1257,180],{"class":165},[159,1259,183],{"class":165},[159,1261,792],{"class":186},[159,1263,436],{"class":165},[159,1265,1266,1268,1270,1272,1274],{"class":161,"line":635},[159,1267,799],{"class":173},[159,1269,180],{"class":165},[159,1271,183],{"class":165},[159,1273,806],{"class":186},[159,1275,436],{"class":165},[159,1277,1278,1280,1282,1284,1286],{"class":161,"line":645},[159,1279,813],{"class":173},[159,1281,180],{"class":165},[159,1283,183],{"class":165},[159,1285,602],{"class":186},[159,1287,436],{"class":165},[159,1289,1290],{"class":161,"line":655},[159,1291,826],{"class":165},[159,1293,1295],{"class":161,"line":1294},18,[159,1296,831],{"class":205},[159,1298,1300,1302,1304],{"class":161,"line":1299},19,[159,1301,648],{"class":165},[159,1303,400],{"class":169},[159,1305,192],{"class":165},[159,1307,1309,1311,1313],{"class":161,"line":1308},20,[159,1310,348],{"class":165},[159,1312,390],{"class":169},[159,1314,192],{"class":165},[1316,1317,1318,1319,1322,1323,1325,1326,148],"warning",{},"Do not point ",[127,1320,1321],{},"aria-activedescendant"," at an item element. The grid removes that element when the item scrolls out of the rendered window, and the attribute then points at nothing. Move real focus with the roving ",[127,1324,1048],{}," from ",[123,1327,1019],{"href":1328},"#keep-the-focused-index-in-a-ref",[1316,1330,1331,1332,1334,1335,1337],{},"When the focused item is not in the DOM, no item has ",[127,1333,1028],{},", and Tab cannot enter the grid. The same happens while the item at the focused index is still a placeholder, because placeholders get no ",[127,1336,1048],{},". Scroll back to the item, or wait for it to load, and Tab reaches the grid again.",[139,1339,1341],{"id":1340},"scroll-to-the-new-item-and-focus-it","Scroll to the new item and focus it",[113,1343,1344,1345,130,1348,1351,1352,1355],{},"Most arrow presses move to an item the grid has already rendered. Scroll that item into view with ",[127,1346,1347],{},"scrollIntoView",[127,1349,1350],{},"block: \"nearest\"",", which scrolls only as far as needed and does nothing when the item is fully visible. Setting ",[127,1353,1354],{},"scrollTo"," on every press would move the item to the top of the grid each time.",[113,1357,1358,1359,1361,1362,1365],{},"Use the grid's ",[127,1360,1354],{}," prop only when the item is not in the DOM. Keep the index for it in a second ref, ",[127,1363,1364],{},"scrollTarget",". The grid scrolls there and renders the item, so focus it after the grid renders it.",[113,1367,1368,1371,1372,1375,1376,1378,1379,1381,1382,1385,1386,1388],{},[127,1369,1370],{},"moveTo"," sets the index and marks that a focus is pending. ",[127,1373,1374],{},"focusFocused"," runs on the next tick and looks for the item element. If it finds none, it sets ",[127,1377,1364],{}," and waits for the grid to render. If it finds one, it clears ",[127,1380,1364],{},", scrolls the element into view and focuses it. ",[127,1383,1384],{},"pendingFocus"," is true from the key press until the item has focus. Without it, ",[127,1387,1374],{}," would also run when the user scrolls with the mouse and pull focus into the grid.",[113,1390,355,1391,363,1394,130,1397,359,1400,1402,1403,1405],{},[127,1392,1393],{},":scroll-to=\"scrollTarget\"",[127,1395,1396],{},"scroll-behavior=\"auto\"",[127,1398,1399],{},"@render=\"focusFocused\"",[127,1401,362],{},". With ",[127,1404,1396],{},", the grid scrolls immediately instead of animating, so focus does not wait for the scroll animation.",[150,1407,1410],{"className":1408,"code":1409,"language":187,"meta":155,"style":155},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import { nextTick, ref } from \"vue\";\n\nconst scrollTarget = ref\u003Cnumber>();\nlet pendingFocus = false;\n\nfunction moveTo(index: number) {\n  focused.value = index;\n  pendingFocus = true;\n  nextTick(focusFocused);\n}\n\nfunction focusFocused() {\n  if (!pendingFocus) return;\n  const element = grid.value?.$el.querySelector\u003CHTMLElement>(\n    `:scope > [data-index=\"${focused.value}\"]`,\n  );\n  if (!element) {\n    scrollTarget.value = focused.value;\n    return;\n  }\n  scrollTarget.value = undefined;\n  element.scrollIntoView({ block: \"nearest\", inline: \"nearest\" });\n  element.focus({ preventScroll: true });\n  if (document.activeElement === element) pendingFocus = false;\n}\n",[127,1411,1412,1437,1441,1466,1482,1486,1508,1525,1537,1550,1555,1559,1570,1590,1628,1656,1663,1679,1699,1706,1711,1726,1771,1798,1828],{"__ignoreMap":155},[159,1413,1414,1416,1418,1421,1423,1425,1427,1429,1431,1433,1435],{"class":161,"line":162},[159,1415,199],{"class":198},[159,1417,202],{"class":165},[159,1419,1420],{"class":205}," nextTick",[159,1422,279],{"class":165},[159,1424,1086],{"class":205},[159,1426,209],{"class":165},[159,1428,212],{"class":198},[159,1430,215],{"class":165},[159,1432,154],{"class":186},[159,1434,183],{"class":165},[159,1436,223],{"class":165},[159,1438,1439],{"class":161,"line":195},[159,1440,230],{"emptyLinePlaceholder":229},[159,1442,1443,1445,1448,1450,1452,1454,1458,1461,1464],{"class":161,"line":226},[159,1444,236],{"class":173},[159,1446,1447],{"class":205}," scrollTarget ",[159,1449,180],{"class":165},[159,1451,1086],{"class":249},[159,1453,166],{"class":165},[159,1455,1457],{"class":1456},"sBMFI","number",[159,1459,1460],{"class":165},">",[159,1462,1463],{"class":205},"()",[159,1465,223],{"class":165},[159,1467,1468,1471,1474,1476,1480],{"class":161,"line":233},[159,1469,1470],{"class":173},"let",[159,1472,1473],{"class":205}," pendingFocus ",[159,1475,180],{"class":165},[159,1477,1479],{"class":1478},"sfNiH"," false",[159,1481,223],{"class":165},[159,1483,1484],{"class":161,"line":328},[159,1485,230],{"emptyLinePlaceholder":229},[159,1487,1488,1491,1494,1496,1498,1500,1503,1505],{"class":161,"line":345},[159,1489,1490],{"class":173},"function",[159,1492,1493],{"class":249}," moveTo",[159,1495,253],{"class":165},[159,1497,580],{"class":275},[159,1499,262],{"class":165},[159,1501,1502],{"class":1456}," number",[159,1504,285],{"class":165},[159,1506,1507],{"class":165}," {\n",[159,1509,1510,1513,1515,1518,1521,1523],{"class":161,"line":476},[159,1511,1512],{"class":205},"  focused",[159,1514,148],{"class":165},[159,1516,1517],{"class":205},"value",[159,1519,1520],{"class":165}," =",[159,1522,538],{"class":205},[159,1524,223],{"class":165},[159,1526,1527,1530,1532,1535],{"class":161,"line":493},[159,1528,1529],{"class":205},"  pendingFocus",[159,1531,1520],{"class":165},[159,1533,1534],{"class":1478}," true",[159,1536,223],{"class":165},[159,1538,1539,1542,1544,1546,1548],{"class":161,"line":508},[159,1540,1541],{"class":249},"  nextTick",[159,1543,253],{"class":169},[159,1545,1374],{"class":205},[159,1547,285],{"class":169},[159,1549,223],{"class":165},[159,1551,1552],{"class":161,"line":514},[159,1553,1554],{"class":165},"}\n",[159,1556,1557],{"class":161,"line":553},[159,1558,230],{"emptyLinePlaceholder":229},[159,1560,1561,1563,1566,1568],{"class":161,"line":609},[159,1562,1490],{"class":173},[159,1564,1565],{"class":249}," focusFocused",[159,1567,1463],{"class":165},[159,1569,1507],{"class":165},[159,1571,1572,1575,1577,1580,1582,1585,1588],{"class":161,"line":615},[159,1573,1574],{"class":198},"  if",[159,1576,272],{"class":169},[159,1578,1579],{"class":165},"!",[159,1581,1384],{"class":205},[159,1583,1584],{"class":169},") ",[159,1586,1587],{"class":198},"return",[159,1589,223],{"class":165},[159,1591,1592,1595,1598,1600,1603,1605,1607,1610,1613,1615,1618,1620,1623,1625],{"class":161,"line":625},[159,1593,1594],{"class":173},"  const",[159,1596,1597],{"class":205}," element",[159,1599,1520],{"class":165},[159,1601,1602],{"class":205}," grid",[159,1604,148],{"class":165},[159,1606,1517],{"class":205},[159,1608,1609],{"class":165},"?.",[159,1611,1612],{"class":205},"$el",[159,1614,148],{"class":165},[159,1616,1617],{"class":249},"querySelector",[159,1619,166],{"class":165},[159,1621,1622],{"class":1456},"HTMLElement",[159,1624,1460],{"class":165},[159,1626,1627],{"class":169},"(\n",[159,1629,1630,1633,1636,1638,1641,1643,1645,1647,1650,1653],{"class":161,"line":635},[159,1631,1632],{"class":165},"    `",[159,1634,1635],{"class":186},":scope > [data-index=\"",[159,1637,306],{"class":165},[159,1639,1640],{"class":205},"focused",[159,1642,148],{"class":165},[159,1644,1517],{"class":205},[159,1646,546],{"class":165},[159,1648,1649],{"class":186},"\"]",[159,1651,1652],{"class":165},"`",[159,1654,1655],{"class":165},",\n",[159,1657,1658,1661],{"class":161,"line":645},[159,1659,1660],{"class":169},"  )",[159,1662,223],{"class":165},[159,1664,1665,1667,1669,1671,1674,1676],{"class":161,"line":655},[159,1666,1574],{"class":198},[159,1668,272],{"class":169},[159,1670,1579],{"class":165},[159,1672,1673],{"class":205},"element",[159,1675,1584],{"class":169},[159,1677,1678],{"class":165},"{\n",[159,1680,1681,1684,1686,1688,1690,1693,1695,1697],{"class":161,"line":1294},[159,1682,1683],{"class":205},"    scrollTarget",[159,1685,148],{"class":165},[159,1687,1517],{"class":205},[159,1689,1520],{"class":165},[159,1691,1692],{"class":205}," focused",[159,1694,148],{"class":165},[159,1696,1517],{"class":205},[159,1698,223],{"class":165},[159,1700,1701,1704],{"class":161,"line":1299},[159,1702,1703],{"class":198},"    return",[159,1705,223],{"class":165},[159,1707,1708],{"class":161,"line":1308},[159,1709,1710],{"class":165},"  }\n",[159,1712,1714,1717,1719,1721,1723],{"class":161,"line":1713},21,[159,1715,1716],{"class":205},"  scrollTarget",[159,1718,148],{"class":165},[159,1720,1517],{"class":205},[159,1722,1520],{"class":165},[159,1724,1725],{"class":165}," undefined;\n",[159,1727,1729,1732,1734,1736,1738,1740,1743,1745,1747,1750,1752,1754,1757,1759,1761,1763,1765,1767,1769],{"class":161,"line":1728},22,[159,1730,1731],{"class":205},"  element",[159,1733,148],{"class":165},[159,1735,1347],{"class":249},[159,1737,253],{"class":169},[159,1739,256],{"class":165},[159,1741,1742],{"class":169}," block",[159,1744,262],{"class":165},[159,1746,215],{"class":165},[159,1748,1749],{"class":186},"nearest",[159,1751,183],{"class":165},[159,1753,279],{"class":165},[159,1755,1756],{"class":169}," inline",[159,1758,262],{"class":165},[159,1760,215],{"class":165},[159,1762,1749],{"class":186},[159,1764,183],{"class":165},[159,1766,209],{"class":165},[159,1768,285],{"class":169},[159,1770,223],{"class":165},[159,1772,1774,1776,1778,1781,1783,1785,1788,1790,1792,1794,1796],{"class":161,"line":1773},23,[159,1775,1731],{"class":205},[159,1777,148],{"class":165},[159,1779,1780],{"class":249},"focus",[159,1782,253],{"class":169},[159,1784,256],{"class":165},[159,1786,1787],{"class":169}," preventScroll",[159,1789,262],{"class":165},[159,1791,1534],{"class":1478},[159,1793,209],{"class":165},[159,1795,285],{"class":169},[159,1797,223],{"class":165},[159,1799,1801,1803,1805,1808,1810,1813,1816,1818,1820,1822,1824,1826],{"class":161,"line":1800},24,[159,1802,1574],{"class":198},[159,1804,272],{"class":169},[159,1806,1807],{"class":205},"document",[159,1809,148],{"class":165},[159,1811,1812],{"class":205},"activeElement",[159,1814,1815],{"class":165}," ===",[159,1817,1597],{"class":205},[159,1819,1584],{"class":169},[159,1821,1384],{"class":205},[159,1823,1520],{"class":165},[159,1825,1479],{"class":1478},[159,1827,223],{"class":165},[159,1829,1831],{"class":161,"line":1830},25,[159,1832,1554],{"class":165},[113,1834,1835,1838,1839,1841,1842,1844,1845,1848,1849,1851,1852,1854],{},[127,1836,1837],{},"preventScroll"," stops the browser from scrolling a second time, because ",[127,1840,1347],{}," already did. Clearing ",[127,1843,1364],{}," stops the grid from scrolling back to an old index when it is resized. The grid may not emit ",[127,1846,1847],{},"render"," when the new item was already rendered, so ",[127,1850,1370],{}," also calls ",[127,1853,1374],{}," on the next tick.",[139,1856,1858],{"id":1857},"listen-for-arrow-keys-on-the-grid","Listen for arrow keys on the grid",[113,1860,355,1861,359,1864,1866],{},[127,1862,1863],{},"@keydown=\"onKeydown\"",[127,1865,362],{},". Key events bubble up from the focused item, so one listener on the grid receives them all.",[113,1868,1869,1870,1873,1874,1877],{},"Map each arrow key to a change of row or column. Convert the focused index to a cell with ",[127,1871,1872],{},"getItemCell",", change the cell, and convert it back with ",[127,1875,1876],{},"getIndexByCell",". Both read a reusable query object, so create it once outside the handler.",[1879,1880,1881],"code-collapse",{},[150,1882,1884],{"className":1408,"code":1883,"language":187,"meta":155,"style":155},"import { createCellQuery, getIndexByCell, getItemCell } from \"vvirtual-grid\u002Fprimitives\";\n\nconst cellQuery = createCellQuery();\n\nfunction onKeydown(event: KeyboardEvent) {\n  const layout = grid.value?.measurement;\n  if (!layout) return;\n\n  cellQuery.layout = layout;\n  cellQuery.index = focused.value;\n  getItemCell(cellQuery);\n\n  const { cell } = cellQuery;\n  if (event.key === \"ArrowDown\") cell.row += 1;\n  else if (event.key === \"ArrowUp\") cell.row -= 1;\n  else if (event.key === \"ArrowRight\") cell.column += 1;\n  else if (event.key === \"ArrowLeft\") cell.column -= 1;\n  else return;\n\n  if (cell.row \u003C 0 || cell.column \u003C 0 || cell.column >= layout.columns) return;\n  const next = getIndexByCell(cellQuery);\n  if (next \u003C 0 || next >= items.length) return;\n\n  event.preventDefault();\n  moveTo(next);\n}\n",[127,1885,1886,1918,1922,1937,1941,1962,1984,2001,2005,2020,2038,2052,2056,2074,2113,2153,2191,2228,2237,2241,2296,2315,2347,2351,2365,2378],{"__ignoreMap":155},[159,1887,1888,1890,1892,1895,1897,1900,1902,1905,1907,1909,1911,1914,1916],{"class":161,"line":162},[159,1889,199],{"class":198},[159,1891,202],{"class":165},[159,1893,1894],{"class":205}," createCellQuery",[159,1896,279],{"class":165},[159,1898,1899],{"class":205}," getIndexByCell",[159,1901,279],{"class":165},[159,1903,1904],{"class":205}," getItemCell",[159,1906,209],{"class":165},[159,1908,212],{"class":198},[159,1910,215],{"class":165},[159,1912,1913],{"class":186},"vvirtual-grid\u002Fprimitives",[159,1915,183],{"class":165},[159,1917,223],{"class":165},[159,1919,1920],{"class":161,"line":195},[159,1921,230],{"emptyLinePlaceholder":229},[159,1923,1924,1926,1929,1931,1933,1935],{"class":161,"line":226},[159,1925,236],{"class":173},[159,1927,1928],{"class":205}," cellQuery ",[159,1930,180],{"class":165},[159,1932,1894],{"class":249},[159,1934,1463],{"class":205},[159,1936,223],{"class":165},[159,1938,1939],{"class":161,"line":233},[159,1940,230],{"emptyLinePlaceholder":229},[159,1942,1943,1945,1948,1950,1953,1955,1958,1960],{"class":161,"line":328},[159,1944,1490],{"class":173},[159,1946,1947],{"class":249}," onKeydown",[159,1949,253],{"class":165},[159,1951,1952],{"class":275},"event",[159,1954,262],{"class":165},[159,1956,1957],{"class":1456}," KeyboardEvent",[159,1959,285],{"class":165},[159,1961,1507],{"class":165},[159,1963,1964,1966,1969,1971,1973,1975,1977,1979,1982],{"class":161,"line":345},[159,1965,1594],{"class":173},[159,1967,1968],{"class":205}," layout",[159,1970,1520],{"class":165},[159,1972,1602],{"class":205},[159,1974,148],{"class":165},[159,1976,1517],{"class":205},[159,1978,1609],{"class":165},[159,1980,1981],{"class":205},"measurement",[159,1983,223],{"class":165},[159,1985,1986,1988,1990,1992,1995,1997,1999],{"class":161,"line":476},[159,1987,1574],{"class":198},[159,1989,272],{"class":169},[159,1991,1579],{"class":165},[159,1993,1994],{"class":205},"layout",[159,1996,1584],{"class":169},[159,1998,1587],{"class":198},[159,2000,223],{"class":165},[159,2002,2003],{"class":161,"line":493},[159,2004,230],{"emptyLinePlaceholder":229},[159,2006,2007,2010,2012,2014,2016,2018],{"class":161,"line":508},[159,2008,2009],{"class":205},"  cellQuery",[159,2011,148],{"class":165},[159,2013,1994],{"class":205},[159,2015,1520],{"class":165},[159,2017,1968],{"class":205},[159,2019,223],{"class":165},[159,2021,2022,2024,2026,2028,2030,2032,2034,2036],{"class":161,"line":514},[159,2023,2009],{"class":205},[159,2025,148],{"class":165},[159,2027,580],{"class":205},[159,2029,1520],{"class":165},[159,2031,1692],{"class":205},[159,2033,148],{"class":165},[159,2035,1517],{"class":205},[159,2037,223],{"class":165},[159,2039,2040,2043,2045,2048,2050],{"class":161,"line":553},[159,2041,2042],{"class":249},"  getItemCell",[159,2044,253],{"class":169},[159,2046,2047],{"class":205},"cellQuery",[159,2049,285],{"class":169},[159,2051,223],{"class":165},[159,2053,2054],{"class":161,"line":609},[159,2055,230],{"emptyLinePlaceholder":229},[159,2057,2058,2060,2062,2065,2067,2069,2072],{"class":161,"line":615},[159,2059,1594],{"class":173},[159,2061,202],{"class":165},[159,2063,2064],{"class":205}," cell",[159,2066,209],{"class":165},[159,2068,1520],{"class":165},[159,2070,2071],{"class":205}," cellQuery",[159,2073,223],{"class":165},[159,2075,2076,2078,2080,2082,2084,2087,2089,2091,2094,2096,2098,2101,2103,2106,2109,2111],{"class":161,"line":625},[159,2077,1574],{"class":198},[159,2079,272],{"class":169},[159,2081,1952],{"class":205},[159,2083,148],{"class":165},[159,2085,2086],{"class":205},"key",[159,2088,1815],{"class":165},[159,2090,215],{"class":165},[159,2092,2093],{"class":186},"ArrowDown",[159,2095,183],{"class":165},[159,2097,1584],{"class":169},[159,2099,2100],{"class":205},"cell",[159,2102,148],{"class":165},[159,2104,2105],{"class":205},"row",[159,2107,2108],{"class":165}," +=",[159,2110,315],{"class":265},[159,2112,223],{"class":165},[159,2114,2115,2118,2121,2123,2125,2127,2129,2131,2133,2136,2138,2140,2142,2144,2146,2149,2151],{"class":161,"line":635},[159,2116,2117],{"class":198},"  else",[159,2119,2120],{"class":198}," if",[159,2122,272],{"class":169},[159,2124,1952],{"class":205},[159,2126,148],{"class":165},[159,2128,2086],{"class":205},[159,2130,1815],{"class":165},[159,2132,215],{"class":165},[159,2134,2135],{"class":186},"ArrowUp",[159,2137,183],{"class":165},[159,2139,1584],{"class":169},[159,2141,2100],{"class":205},[159,2143,148],{"class":165},[159,2145,2105],{"class":205},[159,2147,2148],{"class":165}," -=",[159,2150,315],{"class":265},[159,2152,223],{"class":165},[159,2154,2155,2157,2159,2161,2163,2165,2167,2169,2171,2174,2176,2178,2180,2182,2185,2187,2189],{"class":161,"line":645},[159,2156,2117],{"class":198},[159,2158,2120],{"class":198},[159,2160,272],{"class":169},[159,2162,1952],{"class":205},[159,2164,148],{"class":165},[159,2166,2086],{"class":205},[159,2168,1815],{"class":165},[159,2170,215],{"class":165},[159,2172,2173],{"class":186},"ArrowRight",[159,2175,183],{"class":165},[159,2177,1584],{"class":169},[159,2179,2100],{"class":205},[159,2181,148],{"class":165},[159,2183,2184],{"class":205},"column",[159,2186,2108],{"class":165},[159,2188,315],{"class":265},[159,2190,223],{"class":165},[159,2192,2193,2195,2197,2199,2201,2203,2205,2207,2209,2212,2214,2216,2218,2220,2222,2224,2226],{"class":161,"line":655},[159,2194,2117],{"class":198},[159,2196,2120],{"class":198},[159,2198,272],{"class":169},[159,2200,1952],{"class":205},[159,2202,148],{"class":165},[159,2204,2086],{"class":205},[159,2206,1815],{"class":165},[159,2208,215],{"class":165},[159,2210,2211],{"class":186},"ArrowLeft",[159,2213,183],{"class":165},[159,2215,1584],{"class":169},[159,2217,2100],{"class":205},[159,2219,148],{"class":165},[159,2221,2184],{"class":205},[159,2223,2148],{"class":165},[159,2225,315],{"class":265},[159,2227,223],{"class":165},[159,2229,2230,2232,2235],{"class":161,"line":1294},[159,2231,2117],{"class":198},[159,2233,2234],{"class":198}," return",[159,2236,223],{"class":165},[159,2238,2239],{"class":161,"line":1299},[159,2240,230],{"emptyLinePlaceholder":229},[159,2242,2243,2245,2247,2249,2251,2253,2256,2259,2262,2264,2266,2268,2270,2272,2274,2276,2278,2280,2283,2285,2287,2290,2292,2294],{"class":161,"line":1308},[159,2244,1574],{"class":198},[159,2246,272],{"class":169},[159,2248,2100],{"class":205},[159,2250,148],{"class":165},[159,2252,2105],{"class":205},[159,2254,2255],{"class":165}," \u003C",[159,2257,2258],{"class":265}," 0",[159,2260,2261],{"class":165}," ||",[159,2263,2064],{"class":205},[159,2265,148],{"class":165},[159,2267,2184],{"class":205},[159,2269,2255],{"class":165},[159,2271,2258],{"class":265},[159,2273,2261],{"class":165},[159,2275,2064],{"class":205},[159,2277,148],{"class":165},[159,2279,2184],{"class":205},[159,2281,2282],{"class":165}," >=",[159,2284,1968],{"class":205},[159,2286,148],{"class":165},[159,2288,2289],{"class":205},"columns",[159,2291,1584],{"class":169},[159,2293,1587],{"class":198},[159,2295,223],{"class":165},[159,2297,2298,2300,2303,2305,2307,2309,2311,2313],{"class":161,"line":1713},[159,2299,1594],{"class":173},[159,2301,2302],{"class":205}," next",[159,2304,1520],{"class":165},[159,2306,1899],{"class":249},[159,2308,253],{"class":169},[159,2310,2047],{"class":205},[159,2312,285],{"class":169},[159,2314,223],{"class":165},[159,2316,2317,2319,2321,2324,2326,2328,2330,2332,2334,2337,2339,2341,2343,2345],{"class":161,"line":1728},[159,2318,1574],{"class":198},[159,2320,272],{"class":169},[159,2322,2323],{"class":205},"next",[159,2325,2255],{"class":165},[159,2327,2258],{"class":265},[159,2329,2261],{"class":165},[159,2331,2302],{"class":205},[159,2333,2282],{"class":165},[159,2335,2336],{"class":205}," items",[159,2338,148],{"class":165},[159,2340,444],{"class":205},[159,2342,1584],{"class":169},[159,2344,1587],{"class":198},[159,2346,223],{"class":165},[159,2348,2349],{"class":161,"line":1773},[159,2350,230],{"emptyLinePlaceholder":229},[159,2352,2353,2356,2358,2361,2363],{"class":161,"line":1800},[159,2354,2355],{"class":205},"  event",[159,2357,148],{"class":165},[159,2359,2360],{"class":249},"preventDefault",[159,2362,1463],{"class":169},[159,2364,223],{"class":165},[159,2366,2367,2370,2372,2374,2376],{"class":161,"line":1830},[159,2368,2369],{"class":249},"  moveTo",[159,2371,253],{"class":169},[159,2373,2323],{"class":205},[159,2375,285],{"class":169},[159,2377,223],{"class":165},[159,2379,2381],{"class":161,"line":2380},26,[159,2382,1554],{"class":165},[113,2384,2385,2386,2388],{},"The checks before ",[127,2387,1876],{}," stop the focus at the first row, the first and last column, and the end of the list.",[1316,2390,2391,2392,2395,2396,1402,2399,2402,2403,2406,2407,2410],{},"The check ",[127,2393,2394],{},"cell.column >= layout.columns"," is correct only for the default ",[127,2397,2398],{},"grid-auto-flow: row",[127,2400,2401],{},"grid-auto-flow: column"," the items fill a fixed number of rows and the columns grow with the list. Replace it with ",[127,2404,2405],{},"cell.row >= layout.rows"," there, or read ",[127,2408,2409],{},"layout.flow"," and pick the check that matches.",[113,2412,2413,2414,130,2416,2419],{},"The template combines the bindings from this step with those from ",[123,2415,1019],{"href":1328},[123,2417,1341],{"href":2418},"#scroll-to-the-new-item-and-focus-it",". The slots stay as they are.",[150,2421,2423],{"className":152,"code":2422,"language":154,"meta":155,"style":155},"\u003Ctemplate>\n  \u003Cdiv class=\"h-96 overflow-y-auto\">\n    \u003CVirtualGrid\n      ref=\"grid\"\n      role=\"list\"\n      :length=\"items.length\"\n      :page-size=\"40\"\n      :page-provider=\"pageProvider\"\n      :scroll-to=\"scrollTarget\"\n      scroll-behavior=\"auto\"\n      @keydown=\"onKeydown\"\n      @render=\"focusFocused\"\n      class=\"grid grid-cols-[repeat(auto-fill,minmax(120px,1fr))] gap-2\"\n    >\n      \u003C!-- the default and placeholder slots -->\n    \u003C\u002FVirtualGrid>\n  \u003C\u002Fdiv>\n\u003C\u002Ftemplate>\n",[127,2424,2425,2433,2451,2457,2470,2482,2500,2514,2528,2543,2557,2574,2588,2600,2604,2610,2618,2626],{"__ignoreMap":155},[159,2426,2427,2429,2431],{"class":161,"line":162},[159,2428,166],{"class":165},[159,2430,390],{"class":169},[159,2432,192],{"class":165},[159,2434,2435,2437,2439,2441,2443,2445,2447,2449],{"class":161,"line":195},[159,2436,397],{"class":165},[159,2438,400],{"class":169},[159,2440,403],{"class":173},[159,2442,180],{"class":165},[159,2444,183],{"class":165},[159,2446,410],{"class":186},[159,2448,183],{"class":165},[159,2450,192],{"class":165},[159,2452,2453,2455],{"class":161,"line":226},[159,2454,419],{"class":165},[159,2456,422],{"class":169},[159,2458,2459,2462,2464,2466,2468],{"class":161,"line":233},[159,2460,2461],{"class":173},"      ref",[159,2463,180],{"class":165},[159,2465,183],{"class":165},[159,2467,1125],{"class":186},[159,2469,436],{"class":165},[159,2471,2472,2474,2476,2478,2480],{"class":161,"line":328},[159,2473,427],{"class":173},[159,2475,180],{"class":165},[159,2477,183],{"class":165},[159,2479,129],{"class":186},[159,2481,436],{"class":165},[159,2483,2484,2486,2488,2490,2492,2494,2496,2498],{"class":161,"line":345},[159,2485,441],{"class":165},[159,2487,444],{"class":173},[159,2489,180],{"class":165},[159,2491,183],{"class":165},[159,2493,451],{"class":205},[159,2495,148],{"class":165},[159,2497,444],{"class":205},[159,2499,436],{"class":165},[159,2501,2502,2504,2506,2508,2510,2512],{"class":161,"line":476},[159,2503,441],{"class":165},[159,2505,464],{"class":173},[159,2507,180],{"class":165},[159,2509,183],{"class":165},[159,2511,471],{"class":265},[159,2513,436],{"class":165},[159,2515,2516,2518,2520,2522,2524,2526],{"class":161,"line":493},[159,2517,441],{"class":165},[159,2519,481],{"class":173},[159,2521,180],{"class":165},[159,2523,183],{"class":165},[159,2525,488],{"class":205},[159,2527,436],{"class":165},[159,2529,2530,2532,2535,2537,2539,2541],{"class":161,"line":508},[159,2531,441],{"class":165},[159,2533,2534],{"class":173},"scroll-to",[159,2536,180],{"class":165},[159,2538,183],{"class":165},[159,2540,1364],{"class":205},[159,2542,436],{"class":165},[159,2544,2545,2548,2550,2552,2555],{"class":161,"line":514},[159,2546,2547],{"class":173},"      scroll-behavior",[159,2549,180],{"class":165},[159,2551,183],{"class":165},[159,2553,2554],{"class":186},"auto",[159,2556,436],{"class":165},[159,2558,2559,2562,2565,2567,2569,2572],{"class":161,"line":553},[159,2560,2561],{"class":165},"      @",[159,2563,2564],{"class":173},"keydown",[159,2566,180],{"class":165},[159,2568,183],{"class":165},[159,2570,2571],{"class":205},"onKeydown",[159,2573,436],{"class":165},[159,2575,2576,2578,2580,2582,2584,2586],{"class":161,"line":609},[159,2577,2561],{"class":165},[159,2579,1847],{"class":173},[159,2581,180],{"class":165},[159,2583,183],{"class":165},[159,2585,1374],{"class":205},[159,2587,436],{"class":165},[159,2589,2590,2592,2594,2596,2598],{"class":161,"line":615},[159,2591,496],{"class":173},[159,2593,180],{"class":165},[159,2595,183],{"class":165},[159,2597,503],{"class":186},[159,2599,436],{"class":165},[159,2601,2602],{"class":161,"line":625},[159,2603,511],{"class":165},[159,2605,2606],{"class":161,"line":635},[159,2607,2609],{"class":2608},"sHwdD","      \u003C!-- the default and placeholder slots -->\n",[159,2611,2612,2614,2616],{"class":161,"line":645},[159,2613,638],{"class":165},[159,2615,33],{"class":169},[159,2617,192],{"class":165},[159,2619,2620,2622,2624],{"class":161,"line":655},[159,2621,648],{"class":165},[159,2623,400],{"class":169},[159,2625,192],{"class":165},[159,2627,2628,2630,2632],{"class":161,"line":1294},[159,2629,348],{"class":165},[159,2631,390],{"class":169},[159,2633,192],{"class":165},[139,2635,2637],{"id":2636},"check-it-with-a-screen-reader","Check it with a screen reader",[113,2639,2640,2641,2647],{},"Open the page with VoiceOver on macOS (Cmd + F5) or ",[123,2642,2646],{"href":2643,"rel":2644},"https:\u002F\u002Fwww.nvaccess.org\u002Fdownload\u002F",[2645],"nofollow","NVDA"," on Windows. VoiceOver is the screen reader built into macOS. NVDA is a screen reader for Windows that costs nothing to download and use.",[2649,2650,2651,2655,2658],"ol",{},[2652,2653,2654],"li",{},"Press Tab until the focus reaches the grid. The screen reader announces the first item with its role and its position, 1 of 10,000.",[2652,2656,2657],{},"Press the right arrow. The focus moves to the next item and the screen reader reads it. Press the down arrow. The focus moves to the item one row below, in the same column, and the announced position climbs by however many items fit in a row.",[2652,2659,2660],{},"Press the down arrow many times. The grid scrolls, and the announced position keeps climbing, for example to 4,200 of 10,000.",[113,2662,2663,2664,2666],{},"The wording and the order of the announcement vary by screen reader and browser. ",[123,2665,94],{"href":95}," has runnable versions of each step and instructions for testing without a screen reader.",[568,2668,2669],{},"html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}",{"title":155,"searchDepth":195,"depth":195,"links":2671},[2672,2673,2674,2675,2676,2677,2678],{"id":141,"depth":226,"text":142},{"id":677,"depth":226,"text":678},{"id":850,"depth":226,"text":851},{"id":1018,"depth":226,"text":1019},{"id":1340,"depth":226,"text":1341},{"id":1857,"depth":226,"text":1858},{"id":2636,"depth":226,"text":2637},"Make a screen reader announce \"item 4,200 of 10,000\" and let keyboard users move through the grid.","md",null,{},{"icon":56},{"title":64,"description":2679},"Ai67gpQnvWxsLy3hkoPoFhnQXAAI_WQvINNSc6BYy40",[2687,2689],{"title":53,"path":54,"stem":55,"description":2688,"icon":56,"children":-1},"Which ARIA roles fit a flat, virtualized grid, and which do not.",{"title":68,"path":69,"stem":70,"description":2690,"icon":71,"children":-1},"Open a native popover under a clicked grid item and keep it attached while the grid scrolls.",1794785667993]