18
Hi! We’re here to talk about tabs, accordions, and accessibility. My team recently developed a WordPress theme for Northern Arizona University. The page templates included tabs and accordions. 1

Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

Hi!We’reheretotalkabouttabs,accordions,andaccessibility.MyteamrecentlydevelopedaWordPressthemeforNorthernArizonaUniversity.Thepagetemplatesincludedtabsandaccordions.

1

Page 2: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

ThereweretwobighurdlesweneededtopassforoursitetobeacceptedbyNAU–WCAG2.0AAautomatedtesKng,andpracKcalscreenreadertesKng.WebContentAccessibilityGuidelinesdefinehowtomakeWebcontentavailabletopeoplewithabroadrangeofvisualandphysicalabiliKes.WCAGtes)ngwillspotissuesrelatedtothereadabilityoftext,andthepropercap)oningofimagesandmedia.Second—screenreaders.Thereareafew,includingtheMac’sVoiceOver.ButthegoldstandardisJAWS,ascreenreaderforWindowsthat—forourconcerns—funcKonsasabrowserplugin.ThisisthesoSwarethatmany(ifnotmost)ofyourscreen-reader-usingaudienceisusing,andyoursiteneedstobeusableinJAWStobeconsideredscreen-reader-accessible.Andhere’swherewerunintotrouble.It’stotallypossibletopassWCAGtes)ng,ands)llcompletelyfailprac)caltes)nginJAWS.Why?

2

Page 3: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

First:hiddencontent.Screenreaderstrytheirbesttoemulatetheintendedexperience.Basically—ifcontentishidden(display:none,visibility:hidden),thescreenreaderwillignoreit.And,asyoucansee,mostofourcontentiscurrentlyhidden.WCAGtesKngtoolswon’tflagyouforthis.

3

Page 4: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

Second,theorderofthecontentoftabs.Accordionsareactuallynotthatbad.SemanKcally,whatyouhave—hopefully—isgroupingsofheadersandcontentblocks.Tabspresentagreaterchallenge.Theyhavehiddencontent,andtheassociaKonbetweenlabelsandcontentblocksisremote.Thetabcontrol,strippedtotheskeletonofitspresentaKonlayer,doesnothaveasequenKalrelaKonshipbetweenlabelsandtheircontent.

4

Page 5: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

Withregardtoscreenreaders,correctlydiagnosingtheexistenceofissueswasapre_ybigchallenge.Howmanyofusregularlyuseascreenreader,orwouldconsiderourselvesascreen-readerpower-user?[showofhands]Learningtouseascreenreaderishard.Ifyouhaveanin-houseexpert—that’sgreat!Butifyoudon’t,andyou’reunderacrunch,learningtouseascreenreadermaytakemoreKmethanyouhave.

5

Page 6: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

Wheredoesthatleaveus?Thereisahugeoverlapbetweentherequirementsforscreenreaderaccessibilityandkeyboardnavigability.IfyoucantabthroughyourenKrepage,you’reinverygoodshapeforscreenreadercompliance.So...Wespentalotof)medoingkeyboardnaviga)ontes)ng.Youdon’tneedtoinstallanyspecialsoSwaretodoit,andthere’snolearningcurve.Asforthescreenreaders—ifyou’renotcomfortableusingascreenreader,Istronglyrecommendyouhireaspecialist.WeworkedwithacompanycalledULTRATesKng,whoassignedusatesterwhospecializesinJAWS.HewrotebrilliantKcketsthatsavedushoursandhours.

6

Page 7: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

jQueryUIcomesvery,veryclosetoworking.Andithasafewkeyadvantages.Forone,itwantsyourstarKngpointtobeclean,semanKcHTML.Yourtabscompriseabulletedlistoflinkstocontentregions,andthenthescriptinsertsabunchofstuffintotheDOMaroundit.Theaccordionsareevensimpler—alternaKngheadersanddivs.They’rebothkeyboardnavigable,buttheyfailedourpracKcalscreenreadertesKng.CaliforniaStateUniversityhasawholewebsitededicatedtotheirapproachtoaccessibility,includinglinkstodownloadsthatdescribehowtocreateaccordionsthatpasstheirtesKngcriteria.Nottabs,butitgotusthinkingintherightdirecKon.Bootstrapfallsshort.It’sapopularframeworkandtherearemanyverygoodthingsaboutit.Butitstabsandaccordionsdidn’tpassJAWStesKng.So!Let’stalkaboutsomepracKcalapproachestousingthesecontrolsinaWCAGandscreen-readercompliantenvironment.

7

Page 8: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

OneofthereasonsIlovethejQueryUItoolisthatitoffersa“destroy”method.AllofthejQueryUIwrapperstuffgetsdeleted,andyou’releSwiththeHTMLthatyouwroteinthefirstplace.Bulletedlistoflinkstodivs,andsubheadswithcontentblocks.Nohiddencontent.

8

Page 9: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

Letyourvisitorssaveapreferencefor“EnhancedUsabilityMode”thatdestroysyourtabsandaccordions,orevenpreventsthetab()oraccordion()methodsfrombeinginvokedinthefirstplace.Everybodywins.Allyourvisitorsgettointeractwithyourcontentthewaytheywantto,andyousavedozensofhoursofdevelopmentKme.It’stotallyaccessible,andfasttoimplement.And,let’skeepinmind–“tab”isavisualmetaphorfortheorganizaKonofchunksofcontent.Ifyourvisitorhasneverseenone,orfindstabbedfoldersdifficulttomanipulateinphysicalspace,whyintheworldwouldyouburnhoursofprogrammingKmetopreservethatmetaphor?Finally…evenwhenyou’vegotthisimplementedandworking,andtheinstrucKonsareclear,yourvisitorswhoarenotmousingaroundthepagearegoingtohavedosomepre_ynimbleKonami-codehopscotchtomovebetweentabs,andfromtabstocontent.I’mjustnotsureit’sworthit.So-destroyingtheelement.It’sanopKon.Andhonestly,it’smyfirstrecommendaKon.But,yourstakeholdersmaydecidethatamoreuniformexperienceisrequired—solet’slookathowweimplementedaccessibletabs.

9

Page 10: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

WestartwiththejQueryUItabcontrol,andthenwestartaddinginhelperfeatures.OuridealsoluKonaffordsusspokeninstrucKons,keyboardnavigaKon,andobviousfocusindicaKon.

10

Page 11: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

WewrappedtheenKreelementinadivwiththeclass“tab-instrucKons”andplacedaspantagwiththeclass“instrucKons”immediatelyinsideofthat.RememberthatJAWSa_emptstohonorthedisplay/donotdisplayrulesinyourCSS?Apparently,itdoesn’tgetclipping.So,ourspanwithinstrucKonstobespokengetsclippedtosinglepixel.Now,whenyourusertabstoit,anditreceiveskeyboardfocus,thisinstrucKonwillbereadaloudbyourscreenreader.

11

Page 12: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

Thenweneedtoaddinsomeextrahandlingbasedonkeyboardinput.jQueryUIhandlestheactualhiding,showing,andstatesevng;butitdoesn’tactuallymovekeyboardfocus,whichisacrucialindicatorofwhereyouareonthepage.Remember—thissoluKonisn’tjustforuserswhogetzerovisualinput.LotsofpeopleacrossawiderangeofmotorabilityandvisualacuityuseassisKvetechnology,andobviouskeyboardfocusisvitalfortheseusers.Speakingof…

12

Page 13: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

Obviouskeyboardfocusindica)on.Inmyexperience,somedesignersreallyhateit,butifyouwantanaccessibleexperience,fightforit.GoingbacktoourmodificaKons:

13

Page 14: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

InourpracKcaltesKng,keyboardfocusdidn’tmovecorrectlyfromthetabtotheassociatedcontent,andbackagain.OursoluKoninvolvedplacingaclippedH4elementinthecontentpanel,givingitanegaKvetabindex(whichremovesitfromthenaturaltabindexflow),butdoesallowustoprogrammaKcallyforcefocus.Theresultisthatourvisitorfocusesatab,hitstheirspacebar,andtheirfocusissenttotheappropriatecontentpanel.

14

Page 15: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

Finally,weneedtoaddressthetabindexofthetabsthemselves.jQueryUI’sdefaultbehavioristosettheinacKvetabs’tabindextonegaKveone;butthisremovesthemfromthedocumentflow.TheysKllperform,butthingsgetweirdwhenyoutrygoingbackwardsthroughthetabs,andperformancegetsreallyinconsistentwhenyoutrytomoveenKrelypastthetabcontrol,andthenbackintoit.Weresolvedthoseinconsistenciesbyforcingthetabstoalwayshaveatabindexofzero,keepingtheminthetabindexflowofthedocument.

15

Page 16: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

Accordionsaresimpler.Again,weneedtoappendinstrucKonsandtomanagethetabindexofourcontrols,butbecausethey’realreadysequenKal,theyrequirealotlesshelpercode.

16

Page 17: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

Frankly,thisistheeasypart.WediditallwithanAdvancedCustomFieldsRepeater.It’sapre_ysimplesetoffields—aTabLabel,alayoutselector(onecolumnortwo),andoneortwoWYSIWYGeditorsbasedonyourchosenlayout.

17

Page 18: Hi! We’re here to talk about tabs, accordions, and ... · My team recently developed a WordPress theme for Northern Arizona University. ... the jQuery UI wrapper stuff gets deleted,

ThankyousomuchforsKckingaroundforthispresentaKon.IfIhaveaclosingthought,it’sthis:WhatI’vepresentedgotourwebsitepastfuncKonaltesKngattheendof2016.Itisnotperfect.ItisnottheendallbeallsoluKonforhowtocodethismodule.I’vetakentheworkofexcellentdevelopersatCaliforniaStateandthejQueryUIproject,andbuiltonthat.ItismysinceresthopethatoneofyoutakeswhatI’vepresentedontodayandcomesbacknextyearandblowsmeoutofthewater.

18