When the search button is an image there is no alt-text for the input-element. It should be there for accessibility, if I get it all right.

It would be great if you could add a field in the Settings page for a custom alt-text.

I don't know how to do this by myself.

Thanks

Comments

jdanthinne’s picture

Status: Active » Fixed

You're right, I've commited the changes to the Dev version.
The alt text will be the one entered for the submit button text.

fleshgrinder’s picture

But even if the submit button is empty, there should be an alt-Attribute. Otherwise it's not valid XHTML.

How I did it:

        // Submit button.
        $form['submit']['#value'] = variable_get('custom_search_submit_text', CUSTOM_SEARCH_SUBMIT_TEXT_DEFAULT);
        if (variable_get('custom_search_image_path', '') != '') {
          $form['submit']['#type'] = 'image_button';
          $form['submit']['#src'] = variable_get('custom_search_image_path', '');
          $form['submit']['#name'] = 'op';
          $form['submit']['#attributes']['alt'] = $form['submit']['#value'];
        }
        elseif (empty($form['submit']['#value'])) {
          $form['submit']['#attributes']['style'] = 'display:none;';
        }
jdanthinne’s picture

That's approximately what I've done in my fix. Have you tried the dev version?

fleshgrinder’s picture

No, I wanted to report the problem myself because I noticed the problem on my own and fixed it with the code above.

I had a look at the dev version, it's pretty the same. Only the unset($form['submit']['#value']); will not do anything. I also implemented that in my code in the first place but the value stays in place. Probably because of some theme function within Drupal. But that doesn't matter, the value can stay in place because it's valid XHTML. unset() is not using a lot of PHPs power but a unnecessary function call is always producing some overhead that wouldn't be necessary; I know, it's nearly nothing but ... you know. ;)

PS: I love the module, it was always a pain to do those things in the theme files where no website editor knows how to handle it. Thanks for your work!

jdanthinne’s picture

Thanks. I've removed the unset function. If it could gain 0.0001ms, let's try that :-)

ajuliano’s picture

Thank you for the fix.

I am going to try the dev version soon (I assume it's still there and not in stable?).

And I am saying as @Fleshgrinder: "I love the module, it was always a pain to do those things in the theme files where no website editor knows how to handle it. Thanks for your work!"

Thanks :-)

jdanthinne’s picture

You're welcome.
And yes, it's still in dev. Hope to release a stable version next week.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.