@@ -20,7 +20,7 @@ const metadata: Meta<AkSpinnerProps> = {
2020 defaultValue : { summary : "md" } ,
2121 } ,
2222 } ,
23- label : {
23+ ariaLabel : {
2424 control : "text" ,
2525 description : "Accessible label for screen readers" ,
2626 table : {
@@ -39,7 +39,6 @@ const metadata: Meta<AkSpinnerProps> = {
3939 } ,
4040 args : {
4141 size : "md" ,
42- label : "Loading..." ,
4342 inline : false ,
4443 } ,
4544 parameters : {
@@ -115,7 +114,11 @@ export const CustomColor = () => html`
115114` ;
116115
117116export const AllSizes = ( ) => html `
118- < div style ="display: flex; flex-direction: column; gap: 16px; ">
117+ < main
118+ tabindex ="0 "
119+ aria-label ="All sizes "
120+ style ="display: flex; flex-direction: column; gap: 16px; "
121+ >
119122 < div >
120123 < h3 > Small (sm)</ h3 >
121124 < ak-spinner size ="sm "> </ ak-spinner >
@@ -132,7 +135,7 @@ export const AllSizes = () => html`
132135 < h3 > Extra Large (xl)</ h3 >
133136 < ak-spinner size ="xl "> </ ak-spinner >
134137 </ div >
135- </ div >
138+ </ main >
136139` ;
137140
138141export const InlineSpinners : Story = {
@@ -144,7 +147,11 @@ export const InlineSpinners: Story = {
144147 } ,
145148 } ,
146149 render : ( ) => html `
147- < div style ="display: flex; flex-direction: column; gap: 1rem; ">
150+ < main
151+ tabindex ="0 "
152+ aria-label ="Inline spinners "
153+ style ="display: flex; flex-direction: column; gap: 1rem; "
154+ >
148155 < div style ="font-size: 14px; ">
149156 Small text with < ak-spinner inline label ="Loading small "> </ ak-spinner > inline
150157 spinner
@@ -161,7 +168,7 @@ export const InlineSpinners: Story = {
161168 Extra large text with
162169 < ak-spinner inline label ="Loading extra large "> </ ak-spinner > inline spinner
163170 </ div >
164- </ div >
171+ </ main >
165172 ` ,
166173} ;
167174
@@ -174,7 +181,11 @@ export const CustomAnimations: Story = {
174181 } ,
175182 } ,
176183 render : ( ) => html `
177- < div style ="display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; ">
184+ < main
185+ tabindex ="0 "
186+ aria-label ="Custom animations "
187+ style ="display: flex; gap: 2rem; align-items: center; flex-wrap: wrap; "
188+ >
178189 < div style ="text-align: center; ">
179190 < ak-spinner
180191 size ="lg "
@@ -207,7 +218,7 @@ export const CustomAnimations: Story = {
207218 > </ ak-spinner >
208219 < div style ="margin-top: 0.5rem; font-size: 0.875rem; "> Thick stroke</ div >
209220 </ div >
210- </ div >
221+ </ main >
211222 ` ,
212223} ;
213224
@@ -220,24 +231,40 @@ export const LoadingStates: Story = {
220231 } ,
221232 } ,
222233 render : ( ) => html `
223- < div style ="display: flex; flex-direction: column; gap: 2rem; ">
234+ < main
235+ tabindex ="0 "
236+ aria-label ="Loading states "
237+ style ="display: flex; flex-direction: column; gap: 2rem; "
238+ >
224239 <!-- Page loading -->
225- < div
240+ < section
241+ id ="demo-region-1 "
226242 style ="text-align: center; padding: 3rem; border: 1px dashed #ccc; border-radius: 8px; "
243+ aria-busy ="true "
244+ aria-live ="polite "
245+ aria-label ="Demo Region 1 "
246+ aria-describedby ="demo-region-1-description "
227247 >
228- < ak-spinner size ="xl " label ="Loading page content "> </ ak-spinner >
229- < div style ="margin-top: 1rem; color: #666; "> Loading page content...</ div >
230- </ div >
248+ < ak-spinner size ="xl "> </ ak-spinner >
249+ < div id ="demo-region-1-description " style ="margin-top: 1rem; color: #666; ">
250+ Loading page content...
251+ </ div >
252+ </ section >
231253
232254 <!-- Card loading -->
233- < div
255+ < section
234256 style ="padding: 1.5rem; border: 1px solid #e5e7eb; border-radius: 8px; background: #f9fafb; "
257+ id ="demo-region-1 "
258+ aria-busy ="true "
259+ aria-live ="polite "
260+ aria-label ="Demo Region 2 "
261+ aria-describedby ="demo-region-2-description "
235262 >
236263 < div style ="display: flex; align-items: center; gap: 1rem; ">
237- < ak-spinner size ="md " label =" Loading card data " > </ ak-spinner >
238- < div > Loading card data...</ div >
264+ < ak-spinner size ="md "> </ ak-spinner >
265+ < div id =" demo-region-2-description " > Loading card data...</ div >
239266 </ div >
240- </ div >
267+ </ section >
241268
242269 <!-- List item loading -->
243270 < div style ="display: flex; flex-direction: column; gap: 0.5rem; ">
@@ -254,7 +281,7 @@ export const LoadingStates: Story = {
254281 < div > Loading list item...</ div >
255282 </ div >
256283 </ div >
257- </ div >
284+ </ main >
258285 ` ,
259286} ;
260287
@@ -267,7 +294,11 @@ export const UsingBuilderFunction: Story = {
267294 } ,
268295 } ,
269296 render : ( ) => html `
270- < div style ="display: flex; flex-direction: column; gap: 1.5rem; ">
297+ < main
298+ tabindex ="0 "
299+ aria-label ="Using Builder Function "
300+ style ="display: flex; flex-direction: column; gap: 1.5rem; "
301+ >
271302 < div >
272303 < h4 > Basic spinner with builder:</ h4 >
273304 < div style ="display: flex; align-items: center; gap: 1rem; ">
@@ -279,19 +310,19 @@ export const UsingBuilderFunction: Story = {
279310 < div >
280311 < h4 > Custom size and label:</ h4 >
281312 < div style ="display: flex; align-items: center; gap: 1rem; ">
282- ${ akSpinner ( { size : "lg" , label : "Processing data..." } ) }
313+ ${ akSpinner ( { size : "lg" , ariaLabel : "Processing data..." } ) }
283314 < span > Large spinner with custom label</ span >
284315 </ div >
285316 </ div >
286317
287318 < div >
288319 < h4 > Inline spinner:</ h4 >
289320 < p >
290- Processing your request ${ akSpinner ( { inline : true , label : "Processing" } ) }
321+ Processing your request ${ akSpinner ( { inline : true , ariaLabel : "Processing" } ) }
291322 please wait...
292323 </ p >
293324 </ div >
294- </ div >
325+ </ main >
295326 ` ,
296327} ;
297328
@@ -304,21 +335,20 @@ export const AccessibilityExample: Story = {
304335 } ,
305336 } ,
306337 render : ( ) => html `
307- < div style ="display: flex; flex-direction: column; gap: 2rem; ">
308- < div >
338+ < main tabindex ="0 " aria-label ="All sizes ">
309339 < h4 > Spinners with descriptive labels:</ h4 >
310340 < div style ="display: flex; gap: 2rem; flex-wrap: wrap; ">
311341 < div style ="text-align: center; ">
312- < ak-spinner size ="md " label ="Loading user profile data "> </ ak-spinner >
313- < div style ="margin-top: 0.5rem; font-size: 0.875rem; "> User Profile</ div >
342+ < ak-spinner id =" demo-accessibility-spinner-1 " size ="md " aria- label ="Loading user profile data "> </ ak-spinner >
343+ < div aria-busy =" true " aria-describedby =" demo-accessibility-spinner-1 " style ="margin-top: 0.5rem; font-size: 0.875rem; "> User Profile</ div >
314344 </ div >
315345 < div style ="text-align: center; ">
316- < ak-spinner size ="md " label ="Uploading document, please wait "> </ ak-spinner >
317- < div style ="margin-top: 0.5rem; font-size: 0.875rem; "> File Upload</ div >
346+ < ak-spinner id =" demo-accessibility-spinner-2 " size ="md " aria- label ="Uploading document, please wait "> </ ak-spinner >
347+ < div aria-busy =" true " aria-describedby =" demo-accessibility-spinner-2 " style ="margin-top: 0.5rem; font-size: 0.875rem; "> File Upload</ div >
318348 </ div >
319349 < div style ="text-align: center; ">
320- < ak-spinner size ="md " label ="Saving changes to database "> </ ak-spinner >
321- < div style ="margin-top: 0.5rem; font-size: 0.875rem; "> Save Operation</ div >
350+ < ak-spinner id =" demo-accessibility-spinner-3 " size ="md " aria- label ="Saving changes to database "> </ ak-spinner >
351+ < div aria-busy =" true " aria-describedby =" demo-accessibility-spinner-3 " style ="margin-top: 0.5rem; font-size: 0.875rem; "> Save Operation</ div >
322352 </ div >
323353 </ div >
324354 </ div >
@@ -335,6 +365,6 @@ export const AccessibilityExample: Story = {
335365 < li > Consider pairing with visually hidden text for additional context</ li >
336366 </ ul >
337367 </ div >
338- </ div >
368+ </ main >
339369 ` ,
340370} ;
0 commit comments