3

i was going through a search and found this button in search form.

<button type="submit" class="search-submit">
        <span class="genericon-search"></span>
        <span class="screen-reader-text"><?php echo esc_html_x( 'Search', 'submit button', ); ?></span>

I want to know what's the use of the <span class="screen-reader-text"><?php echo esc_html_x( 'Search', 'submit button', ); ?> in this search form, its also working when i remove this line.

7

This class is used to visually hide elements from sighted users but still allows assistive technologies like screen readers to still present those elements to users who are visually impaired.

For example you may have an icon with Facebook's logo as a link to your page/profile. A sighted user will know that's Facebook but a blind user won't so you would still want "My Facebook Profile" or some other descriptive text to let visually impaired people know more about the link.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.