Linux 软件免费装
Banner图

A11y Buttons

开发者
更新时间 2025年8月28日 04:34
PHP版本: 6.4 及以上
WordPress版本: 6.8
版权: GPLv2 or later
版权网址: 版权信息

标签

a11y block accessibility

下载

0.3.0 0.4.0

详情介绍:

This plugin enables an A11Y Buttons block, which contains some common accessibility buttons that you usually find in a website's top header. The idea is to provide a simple way to have them inserted in any part of your theme, without adding overlays and keep them fully customizable so they can match your design and still offer the required features. The buttons available are: All of the buttons have the following features: We understand that accessibility is a huge topic and that no solution is perfect. We also are by no means "experts" on the subject, so if you have any critics or suggestions, please make contact! Want to contribute? Great! Feel free to open an issue or make a pull request.

安装:

This section describes how to install the plugin and get it working. e.g.
  1. Upload the plugin files to the /wp-content/plugins/a11y-buttons directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the 'Plugins' screen in WordPress

屏幕截图:

  • A "Skip to content" button selected;
  • The published page view, with the accessibility buttons on top;
  • High contrast mode activated;
  • Font size increased;
  • Font size decreased;

常见问题:

Why aren't the buttons working in the editor?

To avoid conflicts that could break the editor experience, we opted to make the buttons interactive only on the published page, that is, outside the editor. This is valid for all the buttons, except for the Skip to link.

Why aren't all my fonts scaling with the Increase/Decrease buttons?

This plugin uses a strategy of updating the HTML root font-size only. This means that your fonts will only respond to changes if they are set in CSS relative units, such as rem. Other plugins achieve scaling by an "opinionated" strategy of setting different font sizes to different elements in the inner HTML tags. While we would recommend you to work with relative units, we also believe it is valid to discuss that...

Do I really need to offer font Increase/Decrease buttons to my users?

This is a valid discussion as nowadays, each Browser dedicated Zoom feature can handle scaling much better, no matter which CSS unit you are using. Often, if your site has decent mobile responsiveness, its layout will be nice in a Browser-zoomed scenario. However, one can argue that the fact that everything is scaled (including images) pollutes much of the relevant, readable content. In the end, it is a topic that we are not 100% sure about and would love to find more research related to it.

How do I set my skip link to a specific part of my site?

Skip links should use HTML anchor navigation, which is done via IDs. If the ID is not set in the code, you can configure it via a block. To set an anchor to a search bar, for example, select its block in the site editor and scroll to the Advanced section in the block settings tab. Most blocks have an area there to define an anchor. You can then define it as search-bar-area and then type #search-bar-area as your link in the button block settings.

Why is my Skip to Link button styled differently from the other buttons?

Internally, the Skip to link button is an anchor (<a>) tag, as its role is related to navigation. The other ones are actual <button> tags as they perform actions and not as linking. You may use the block formatting and settings to make them similar to each other.

How are my preferences stored?

The plugin keeps track of font-size and contrast toggle state preferences across pages using sessionStorage. Make sure to warn your users if you feel that can be sensible.

Can I have accesskey on each button?

Originally, we planned to have a simple feature to add accesskey to each button. After reading this, we gave up.

Can I invert the color of an image in High Contrast mode?

Yes! If you have an image like a monochromatic logo that would make sense to be inverted, add the class a11y-invert-on-contrast-mode to it so it can be inverted.

Can you please explain me better the "Asset Loading Method" option in Admin → Settings → A11Y Buttons?

I know, it is a bit confusing and advanced topic. If you keep the default ("On-Demand Loading"), a small JS script will always be loaded in your website. This script will be responsible for detecting the presence of A11Y Buttons, add interactivity for them and, when needed, enqueue CSS assets like the ones used by High Contrast and Readable Font buttons. The idea is that the style is only inserted in the HTML header if the button is clicked. It also works if you used not the Gutenberg block but a simple HTML markup to mimic the block. However, this has a performance issue: the CSS are not cacheable. By using the second option ("Block Detection Loading") we leverage the entire assets enqueue job to WordPress. If it detects a buttons block in that page it will load both the JS script and the CSS files. This allow them to be cacheable. The disadvantage is that all CSS will be loaded even if a certain button is not used... but keep in mind that they are really small. This also won't work for the rare scenarios where you are building your HTML markup by hand instead of using blocks.

更新日志:

0.4.0 0.3.0 0.2.0 0.1.2 0.1.1 0.1.0