Re: Bartik theme

How would I go about removing the element-invisible class from the h2 element?

The source code for the Search form is as follows:

<form accept-charset="UTF-8" id="search-block-form" method="post" action="/node"><div><div class="container-inline">
      <h2 class="element-invisible">Search form</h2>
    <div class="form-item form-type-textfield form-item-search-block-form">
  <label for="edit-search-block-form--2" class="element-invisible">Search </label>
 <input type="text" class="form-text" maxlength="128" size="15" value="" name="search_block_form" id="edit-search-block-form--2" title="Enter the terms you wish to search for.">
</div>
<div id="edit-actions" class="form-actions form-wrapper"><input type="submit" class="form-submit" value="Search" name="op" id="edit-submit"></div><input type="hidden" value="form-lUOxlXQkLmo7_-8gubnhTureiZByWixMGyptsfDAln0" name="form_build_id">
<input type="hidden" value="fSRUKGMO5orfc9Z_VV8Tgqad0yV3Yfu5PuCXGqBObD8" name="form_token">
<input type="hidden" value="search_block_form" name="form_id">
</div>
</div></form>

Comments

vm’s picture

likely a hook form alter in a custom module or a preprocess function

jaypan’s picture

You generally shouldn't remove these elements. They are there for screen readers (which are used by blind people) to make your site accessible (to blind people). Removing these elements will only cut these users off, and in some countries with some industries that's actually illegal. Or at least, there are legal issues that go along with it.

Since they are hidden elements, they shouldn't be causing you any troubles.

Contact me to contract me for D7 -> D10/11 migrations.

new123456789’s picture

I was going to unhide it though...

jaypan’s picture

Sorry, I misread your original post. I thought you wanted to remove the element, I didn't realize you just wanted to remove the class. In that case, you can remove that class in search-block-form.tpl.php.

Contact me to contract me for D7 -> D10/11 migrations.

new123456789’s picture

Thanks for that.

The search-block-form.tpl.php is in the search core module.
I copied the file and pasted it in the search folder I created in my sites/all/modules folder.
I then removed the element, but the change isn't being reflected. What am I missing?
Am I doing this all wrong?

jaypan’s picture

You need to put the copy of the file in your theme directory, not your modules directly. And not in the 'themes' directory, but in your actual theme directory.

Contact me to contract me for D7 -> D10/11 migrations.

new123456789’s picture

Thank you so much! It worked!

craigtockman’s picture

SEO guy is telling me that since this is the first thing at the top of the page, and an H2, it creates seo issues. How do we accommodate both concerns?

jaypan’s picture

The best thing you would do would be to fire your SEO guy. They always talk like they know what they are talking about, but they have no clue and are just guessing. SEO 'experts' are the single biggest scam in the internet world. They are the internet version of astrologists.

Contact me to contract me for D7 -> D10/11 migrations.

abart83’s picture

100% agree with Jaypan, these kind of SEO experts are just idiots!

caspervoogt’s picture

I agree SEO experts are a huge scam.

However .. for "A" level accessibility under WCAG 2.0, the first heading on the page should be an H1, not H2. So if for example you have a search block in your header and then an H1 farther down the page, it won't pass even the A level audit, which is the easiest one.

So I think there are valid use cases where removal of such an invisible element (or changing it from an h2 to some other element) is warranted.

shomari’s picture

I stumbled upon this thread because I have the same use case. Site won't pass accessibility test because the search box is at the top of the page.

shomari’s picture

I stumbled upon this thread because I have the same use case. Site won't pass accessibility test because the search box is at the top of the page.