zuluk zuluk - 1 month ago 20
HTML Question

Is a h3-tag allowed within legend of fieldset?

I have developed an application with forms. These forms are structured with fieldsets so you can see which input fields belong to a section. Each fieldset has a legend. The code looks like:

<label>Title: <input id="title" type="text"/></label>
<button>Create Object</button>

Now we did a screenreader test, because we have blind users. We mentioned, that the screenreader (JAWS) reads the Title in
just as normal text. So it reads:"Title. Title. Input for title." However we expect sth like: "Caption Title. Title. Input for title."

The user said it would be better if the legend would be a caption so she can jump to section with a JAWL-command.

Now my question is: Is it allowed (HTML specification) to wrap the filedset-legend around a e.g.

<label>Title: <input id="title" type="text"/></label>
<button>Create Object</button>

If it is not allowed what would be your solution for this issue? Programming an customized fieldset?

The goal is that the screenreader makes a difference between legend-text and normal text when reading the page. How can I achieve this?


Personally i would rather provide for my users than stick to the rules when it comes to this.

If you do indeed use a h3 tag in your legends, so be it - your users will be most grateful. The only person that wins by sticking to valid html here is you, and that's of no benefit to the user. -- However, im not sure you actually need a fieldset/legend here.

As OP is using this for an internal app / intranet, i beleive it is perfectly ok to disregard SEO and search engine / spiders..