Astra_Enqueue_Scripts::astra_skip_link_focus_fix()

Fix skip link focus in IE11.


Description

This does not enqueue the script because it is tiny and because it is only for IE11, thus it does not warrant having an entire dedicated blocking script being loaded.


Source

File: inc/core/class-astra-enqueue-scripts.php

		public function astra_skip_link_focus_fix() {
			// Skip printing script on AMP content, since accessibility fix is covered by AMP framework.
			if ( astra_is_amp_endpoint() ) {
				return;
			}

			// The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`.
			?>
			<script>
			/(trident|msie)/i.test(navigator.userAgent)&&document.getElementById&&window.addEventListener&&window.addEventListener("hashchange",function(){var t,e=location.hash.substring(1);/^[A-z0-9_-]+$/.test(e)&&(t=document.getElementById(e))&&(/^(?:a|select|input|button|textarea)$/i.test(t.tagName)||(t.tabIndex=-1),t.focus())},!1);
			</script>
			<?php
		}

User Contributed Notes

You must log in before being able to contribute a note or feedback.