SkipTo.js for WCAG Bypass Blocks

Configuration Options

All settings have a default value, a data-skipto attribute on the script element or a global configuration object (e.g. SkipToConfig) can be used to change the default values and to localize the menu text to a specific language.

Options for adding the button element

The following options are useful for identify where the menu will be in the DOM structure of the page and which elements will be used as the container for the menu button. The options are of type string.

Property default Description
containerElement ‘nav’ Container element tag name for the SkipTo.js button and menu. The default value is nav and the only other allowed value is div. Use the div value if you do not want a navigation landmark created by SkipTo.js.
displayOption ‘static’ The allowed values include static, popup or popup-border:
  • static: The button is always visible at the top of the page even when the page scrolls, making the SkipTo.js features available to all users to benefit from.

    Note: This option also includes a "hide" button for users who want to hide the "Skip To Content" button when it obscures some page content. The SkipTo.js button is still available as a popup option and returns to static behavior when the the cookie history is "cleared" or the browser is restarted.

  • popup: The button is initially not visible, but becomes visible when it receives focus.
  • popup-border: Is similar to the "popup" option except the bottom border of button is always visible. The entire button becomes visible when it receives focus (e.g same a "popup" option) and when the pointer is moved over the exposed border.

NOTE: The static and to some extent the popup-border options makes the button and menu discoverable by pointer users, making the SkipTo.js features available to all users to benefit from.

highlightTarget ‘instant’ The allowed values include:
  • disabled: Scrolling target into view is disabled.
  • instant: The target of the menu item is scrolled into view immediately when the item receives focus.
  • smooth: The target of the menu item is scrolled into view slowly when the item receives focus.
  • enabled (deprecated): Same as instant.
customClass
(Deprecated)
none CSS class added to the container element (e.g. nav or div). Can be used for customize styling of the button and menu with author supplied stylesheet. This feature is deprecated since SkipTo.js is now using a custom element, which make using custom class more difficut. Support maybe removed in future versions.

NOTE: The attachElement property is no longer supported due to scroll to content feature and the menu being in a fixed position at the top of the page.

Button Positioning

Property Type Default Description
positionLeft length 46% The position of the “Skip To Content” button from left margin.

Button Font Family and Font Size

Property Type Default Description
fontSize CSS font size inherit Set the CSS font-size using the configuration object. The default is inheriting the font size from the page.
fontFamily CSS font string inherit Set the CSS font-family using the configuration object. The default is inheriting the font family from the page.

Identifying Landmarks and Headings for the menu

The landmarks and ‘headings’ options are a space separated list of tag and landmark region names to identify the important landmark regions and headings on the page for the purpose of keyboard navigation. The list of landmarks and headings should be relatively short, the more items the menu contains the more time the user will need to scan and navigate to the section they want to “skip to”. The values are considered tokens to maximize compatibility with version 4 CSS selectors for these properties.

The options are of type string.

Property Default Description
landmarks ‘main search navigation complementary’ A space separated list of landmark names.
Allowed values include:
  • banner
  • complementary
  • contentinfo
  • main
  • navigation
  • region
  • search
headings ‘h1 h2’ A space separated list of heading tags, when the “main-only” value is included only headings contained in the main landmark region will be included.
Allowed values include:
  • h1
  • h2
  • h3
  • h4
  • h5
  • h6
  • main-only
  • main (deprecated)

Color Theme Options

A color theme sets all the color options defined by the theme.

Property Type Default Description
colorTheme string default A predefined color scheme for skipTo

Current Color Theme Values:

  • ‘aria’ : Used in ARIA Authoring practices
  • ‘illinois’: Used by the University of Illinois at Champaign/Urbana
  • ‘skipto’: Used by this website and OpenA11y project documentation websites
  • ‘uic’ : Used by the University of Illinois at Chicago
  • ‘uillinois’ : Used by the University of Illinois Administration
  • ‘uis’ : Used by the University of Illinois at Springfield
  • ‘openweba11y’ : Used by Open Web Accessibility Services
  • 'wisc': A theme inspired by University of Wisconsin brading colors.
  • If you would like a theme added for your organization, please file an issue with the desired colors

Colors used for Button and Menu styling

Color values must use CSS color values, for example #8AF, rgb(40, 50, 90), #a0bf32, blue.

Property Type Default Description
buttonTextColor Color hsl(216, 60%, 18%) Color of text for “Skip To Content” button.
buttonTextDarkColor Color hsl(216, 60%, 72%) Color of text for “Skip To Content” button in dark appearance mode.
buttonBackgroundColor Color hsl(0, 0%, 87%) Background color of text for “Skip To Content” button.
buttonBackgroundDarkColor Color hsl(0, 0%, 13%) Background color of text for “Skip To Content” button in dark appearance mode.
focusBorderColor Color hsl(358, 95%, 40%) Border color for items with keyboard focus.
focusBorderColor Color hsl(358, 95%, 60%) Border color for items with keyboard focus in dark appearance mode.
menuTextColor Color hsl(216, 60%, 18%) Menu text color
menuTextDarkColor Color hsl(216, 60%, 72%) Menu text color in dark appearance mode.
menuBackgroundColor Color hsl(0, 0%, 87%) Menu background color.
menuBackgroundDarkColor Color hsl(0, 0%, 13%) Menu background color in dark appearance mode.
menuitemFocusTextColor Color hsl(0, 0%, 87%) Menuitem text color when a menuitem has focus.
menuitemFocusTextColor Color hsl(0, 0%, 13%) Menuitem text color when a menuitem has focus in dark appearance mode.
menuitemFocusBackgroundColor Color hsl(216, 60%, 18%) Menuitem text background when a menuitem has focus.
menuitemFocusBackgroundDarkColor Color hsl(216, 60%, 72%) Menuitem text background when a menuitem has focus.

NOTE: Make sure colors meet the color contrast requirements of WCAG 2.1 for text

Internationalization (I18N)

The text labels and messages can be updated through configuration to local language requirements.

Button Labeling

The labels and messages can be localized for specific languages or reflect user preferences.

Property Default Description
buttonLabel ‘Skip to Content’ Change the text label of the menu button.
smallButtonLabel ‘SkipTo’ Change the text label of the menu button in small screen sizes.
altLabel ‘Alt’ Label for modifier key for Windows and Unix/Linux operating systems
optionLabel ‘Option’ Label for modifier key for macOS operating systems
shortcutLabel ‘shortcut’ Label for shortcut label used in defining aria-label for button.

NOTE: altButtonLabel and optionButtonLabel are deprecated as configuration options. The values are computed from buttonLabel, altLabel, optionLabel and shortcutLabel and .

The labels and messages can be localized for specific languages or reflect user preferences.

Property Default Description
menuLabel ‘Landmarks and Headings’ Change the label for the menu.
landmarkGroupLabel ‘Landmark Regions’ Menu group label for landmarks .
headingGroupLabel ‘Headings’ Menu group label for headings.
headingMainGroupLabel ‘Headings in Main Region’ Menu group label for headings when only headings in the main region are in the menu.
headingLevelLabel ‘Heading level’ Used for aria-label to improve labeling of heading menu items for screen reader users.

The names of landmark region names can be localized for specific languages or reflect user preferences.

Property Default Description
mainLabel ‘main’ The label in the menu for main landmarks
searchLabel ‘search’ The label in the menu for search landmarks
navLabel ‘navigation’ The label in the menu for navigation landmarks
asideLabel ‘aside’ The label in the menu for complementary landmarks
footerLabel ‘footer’ The label in the menu for contentinfo landmarks
headerLabel ‘header’ The label in the menu for banner landmarks
formLabel ‘form’ The label in the menu for form landmarks
msgNoLandmarksFound ‘No landmarks to skip to’ Message for when no landmarks are found.
msgNoHeadingsFound ‘No main headings to skip to’ Message for when no headings are found.

About Dialog

Setting and internationalization messaging in the About Dialog.

Property Default Description
aboutSupported true If the value is 'true' the "About SkipTo.js" menu item is included in the menu, otherwise the about option is not included.
aboutInfoLabel ‘About SkipTo.js’ Title of the About dialog box.
aboutDescLabel ‘Purpose’ Label to for the description information.
aboutDesc ‘SkipTo.js is a free and open source utility to support implementing the WCAG 2.4.1 Bypass Block requirement.’ A description of SkipTo.js, emphasizing it is free to use and open source and does not collect any information.
aboutShortcutLabel '"Skip To Content" Button Shortcut' Label for the Menu Button Shortcut.
aboutShortcut ‘Open menu’ What the shortcut key does (e.g. open the menu)
aboutPrivacyLabel ‘Privacy’ A label for the privacy statement.
aboutPrivacy ‘SkipTo.js does not collect or store any information about users or work with any other parties to collect or share user browsing information.’ Privacy statement.
aboutVersion ‘Version ${this.version}’ Version number.
aboutCopyright ‘BSD License, Copyright 2021-2025’ Copyright and license information.
aboutHappy ‘Happy Skipping!’ Happy message to encourage people to use SkipTo.js.

Shortcut Keys

The shortcuts used to sequentially navigate landmark regions and headings.

Property Default Description
shortcutHeadingNext 'h' Next headings
shortcutHeadingPrevious 'H' Previous headings
shortcutHeadingH1 '1' Level 1 headings
shortcutHeadingH2 '2' Level 2 headings
shortcutHeadingH3 '3' Level 3 headings
shortcutHeadingH4 '4' Level 4 headings
shortcutHeadingH5 '5' Level 5 headings
shortcutHeadingH6 '6' Level 6 headings
shortcutRegionNext 'r' Next landmark region
shortcutRegionPrevious 'R' Previous landmark region
shortcutRegionMain 'm' Main landmark regions
shortcutRegionNavigation 'n' Navigation landmark regions
shortcutRegionComplementary 'c' Complementary landmark regions

Shortcuts Menu Items

The internationalization of shortcut information in the menu.

Property Default Description
shortcutsInfoLabel 'Keyboard Shortcuts' Group labeling for shortcut items in the menu.
shortcutsGroupEnabledLabel 'Shortcuts: Enabled' Indicates shortcuts are currently enabled
shortcutsGroupDisabledLabel 'Shortcuts: Disabled' Indicates shortcuts are currently disabled
shortcutsToggleEnableLabel 'Enable shortcuts' Menu item to enable shortcuts.
shortcutsToggleDisableLabel 'Disable shortcuts' Menu item to disable shortcuts.

Shortcut Messages

Messages used in the shortcuts and message dialogs.

Property Default Description
closeLabel 'Close' Label for Close buttons in dialog boxes.
moreInfoLabel 'More Information' Label for More Information button in dialog boxes.
msgKey 'Key' Heading for the key column in the shortcut tables.
msgDescription 'Description' Heading for the description column in the shortcut tables.
msgDescription 'Description' Heading for the description column in the shortcut tables.
msgNextRegion 'Next region' Message for next region shortcut.
msgPreviousRegion 'Previous region' Message for previous region shortcut.
msgRegionIsHidden 'Region is hidden' Message when regions are hidden on the page.
msgMainRegions 'Main regions' Message for main region shortcut.
msgNavigationRegions 'Navigation regions' Message for navigation region shortcut.
msgComplementaryRegions 'Complementary regions' Message for complementary region shortcut.
msgNextHeading 'Next heading' Message for next heading shortcut.
msgPreviousHeading 'Previous heading' Message for previous heading shortcut.
msgHeadingIsHidden 'Heading is hidden' Message when a heading is hidden on the page.
msgHeadingLevel 'Level #' Message a heading level.
msgH1Headings 'Level 1 headings' Message for a level 1 heading.
msgH2Headings 'Level 2 headings' Message for a level 2 heading.
msgH3Headings 'Level 3 headings' Message for a level 3 heading.
msgH4Headings 'Level 4 headings' Message for a level 4 heading.
msgH5Headings 'Level 5 headings' Message for a level 5 heading.
msgH6Headings 'Level 6 headings' Message for a level 6 heading.
msgMessageLabel 'SkipTo.js Message' Label for SkipTo.js message dialog.
msgNoMoreRegions 'No more regions' Message when a there is no previous or next region.
msgNoRegionsFound 'No %r regions found' Message when a there is no previous or next region of a certain type.
msgNoMoreHeadings 'No more headings' Message when a there is no previous or next heading.
msgNoHeadingsLevelFound 'No level %h headings found' Message when a there is no previous or next heading of a certain level.

Example Settings

There are two ways for an author to configure SkipTo.js:

  1. data-skipto attribute
  2. Global variable

Settings Using Data Attribute

You can customize SkipTo.js to the features of your website by using a data-skipto attribute on the script element. Each property/value setting is separated by a semi-colon (;), and each property name and value is separated by a colon (:).

The following is a sample configuration:

<script
  data-skipto="landmarks: main search navigation; headings: h1 h2 h3; colorTheme: illinois"
  src="https://skipto-landmarks-headings.github.io/page-script-5/dist/skipto.min.js">
</script>

Settings Using Global Object

You can customize SkipTo.js to the features of your website by using a global object variable.

The following is a sample configuration:

<script>
  var SkipToConfig =  {
    landmarks: 'main search navigation',
    headings: 'h1 h2 h3',
    colorTheme: 'illinois'
  };
</script>

or

<script>
  window.SkipToConfig =  {};
  window.SkipToConfig.landmarks  = 'main search navigation';
  window.SkipToConfig.headings   = 'h1 h2 h3';
  window.SkipToConfig.colorTheme = 'illinois';
</script>

NOTE: Configuration objects in version 4.x are still supported for compatibility with existing installations. Version 5.x is providing a less complex object for customizing SkipTo.js.