question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Request] Render question titles in <label> instead of <h5>

See original GitHub issue

Are you requesting a feature, reporting a bug or ask a question?

Feature

What is the current behavior?

The titles of form fields are rendered within a <h5> and <span> tag.

Taken from Vue version:

<h5><span style="position: static;"><span style="position: static;">Phone</span></span></h5>

What is the expected behavior?

For screen readers and usability it would be better if this could be rendered in a <label for="{fieldId}"> tag.

<label for="phone_field_id">Phone</label>
  • surveyjs platform (angular or react or jquery or knockout or vue): Vue
  • surveyjs version: v1.0.7

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
kaphertcommented, Feb 15, 2018

For the one who is interested. The following event listener will do the trick by replacing the h5 tag with a label tag.

survey.onAfterRenderQuestion.add(function (sender, options) {
    let title = options.htmlElement.getElementsByTagName('H5')[0];
    if (title) {
        title.outerHTML = '<label for="'+ options.question.inputId +'" class="'+ title.className +'">'+ title.innerHTML +'</label>';
    }
});
0reactions
kaphertcommented, Feb 15, 2018

Above solution is not working because of: https://github.com/surveyjs/surveyjs/issues/930

Read more comments on GitHub >

github_iconTop Results From Across the Web

H5 Scripting - Developing for Infor Smart Office
If you are using TypeScript, you can simply make the variables block-scoped by using 'let' instead of 'var' when you loop through the...
Read more >
title - HTML: HyperText Markup Language - MDN Web Docs
The title global attribute contains text representing advisory information related to the element it belongs to.
Read more >
Unable to render images in caraousel from database ...
I am trying to render images from my database to carousel in Django. ... CaraouselData.objects.all() return render(request, 'index.html', ...
Read more >
Header Tags: A Simple (But Complete) Guide To H1, H2 ...
It's contents are not rendered on the page but are critical for SEO. It's the place in your code where your Page Title,...
Read more >
Documentation Style Guide - GitLab Docs
For style questions, mention @tw-style in an issue or merge request. ... It also fails when a document has non-standard Markdown (which may...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found