Create fully accessible content spoilers or accordions with a shortcode.
- Fully accessible to screen reader users
- Creates a flexible spoiler shortcode
- Define groups of accordions to close open accordions when another in the same group is opened.
- Override design in theme CSS files
[spoiler title="Sample Code" initial_state="expanded" tag="h2" group="a"]
Include content here
title: should include the clickable text to be displayed in your accordion
initial_state: values include collapsed or expanded, default to « collapsed »
group: any alphanumeric value. used to define a group of accordions. when one accordion is opened all other items in the group will be closed.
tag: values include any typical html tag but a heading tag should be used for accessibility, defaults to H2
- Install via WordPress Dashboard or upload
- Activate the plugin through the ‘Plugins’ menu in WordPress;
- Use « spoiler » shortcode in your content;
How can I customize design of the spoiler?
Override the styles found in
styles/simple-accessible-spoilers-styles.cssin your theme css files
Contributors & Developers
“Simple Accessible Spoilers” is open source software. The following people have contributed to this plugin.Contributors
Interested in development?
- removed check for post before enqueueing styles and scripts to allow the shortcode to run in archive templates
- changed to expansion speed of accordians to slow
- modernized the look of the spoilers but adding rounded corners and updated icons
- corrected page scroll when space bar is used to toggle accordian
- corrected aria-expanded not updating on non-active elements when another element in the same group is activated
- corrected spoiler titles being stripped when certain accented characters exists in the title
- added option to customize shortcode
- changed spoiler toggle role to link to correct validation issue
- Added attribute input validation
- Added option to group accordions so that opening a new accordion will close opened items in the same list.
- WordPress 5.5 Compatibility release
- corrected bug resulting in initial state not displaying correctly
- corrected php not object error when post object is not found in a page
- added jquery dependency to wp_register_script to correct jquery not being loaded in some themes
- corrected bug with scripts not enqueue as expected
- added dashboard messages