Checking a accessibility for a page with Wave

blog header image

If you aren’t already aware, the great people at WebAIM has provided a neat service called Wave that can check a webpage for accessibility issues and give you a chance to correct them. Frederik Vig used it as part of a cool test gadget for the gadget contest 2009 (“aha” I read your thoughts – “does this mean that there will be a contest in 2010?”. Well – stay tuned and find out).

I figured I’d extend his idea a little and make a miniature plugin that gives you the option of having wave evaluating every page from the right-click menu.

Since this redirects to Wave and sends along the URL of the current page it only works on publicly available urls. If you want to evaluate sites that are not yet public.

The source is here (use at own risk):

   1: using System;
   2: using System.Collections.Generic;
   3: using System.Linq;
   4: using System.Web;
   5: using EPiServer.PlugIn;
   6:  
   7: namespace EPiServer.Research.Validation
   8: {
   9:     [PagePlugIn()]
  10:     public class WaveChecker
  11:     {
  12:         public const string waveSrc1 = "http://wave.webaim.org/report?url=";
  13:  
  14:         public static void Initialize(int bitflags)
  15:         {
  16:             EPiServer.PageBase.PageSetup += new EPiServer.PageSetupEventHandler(PageBase_PageSetup);
  17:         }
  18:  
  19:         static void PageBase_PageSetup(EPiServer.PageBase sender, EPiServer.PageSetupEventArgs e)
  20:         {
  21:             sender.PreRender += new EventHandler(sender_PreRender);
  22:         }
  23:  
  24:         static void sender_PreRender(object sender, EventArgs e)
  25:         {
  26:             (sender as EPiServer.PageBase).ContextMenu.Menu.Add(
  27:                 "Wave",
  28:                 EPiServer.Security.AccessLevel.Edit,
  29:                 new EPiServer.RightClickMenuItem("Check Accessibility with WAVE", "window.location.href = '"+waveSrc1+"' + encodeURIComponent(window.location.href)", RightClickMode.View)
  30:                 );
  31:  
  32:  
  33:         }
  34:  
  35:     }
  36: }
Recent posts