Survey-library: Pressing markdown link focuses the answer input

Created on 4 Aug 2020  路  6Comments  路  Source: surveyjs/survey-library

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

Bug

What is the current behavior?

Pressing on a link inside a question description focuses the answer input.

What is the expected behavior?

Pressing on a link should open the link.

How would you reproduce the current behavior (if this is a bug)?

  1. Use markdown example
  2. Add question description with link
  3. Press link

Provide the test code and the tested page URL (if applicable)

Tested page URL: https://plnkr.co/edit/SzheBTFLcoIqDweV

Specify your

  • browser: Google Chrome
  • browser version: 84
  • surveyjs platform (angular or react or jquery or knockout or vue): angular
  • surveyjs version: 1.7.24
bug fixed

All 6 comments

@MrKrabat Definitely a bug we will take a look.

Thank you,
Andrew

as a temporary workaround you can use the following code:

survey
  .onAfterRenderQuestion.add(function(sender, options) {
    var linkEl = options.htmlElement.querySelector(".sv-description").querySelector("a");
    linkEl.onclick = function(e) {
      e.stopPropagation();
    }
  });

here the updated example: https://plnkr.co/edit/5BGUcS3fhUruBoOn

We have the same problem with links in question titles, after updating the Surveyjs library they stopped working.

I have two code examples:

one on 1.7.20 with a working link in the question title:
https://plnkr.co/edit/v5k1kAulRHTcBoQj?preview

and one on 1.7.21 with a broken link:
https://plnkr.co/edit/3CGF37FasLcLR5UU?preview

The only difference between both examples is the version of the survey library. The problem must have been introduced in version 1.7.21.
Version 1.8.0 also has this problem.

https://github.com/surveyjs/survey-library/compare/v1.7.20...v1.7.21

Yes, this issue was tagged as v1.7.26, but no commit was made to fix it.

We did not find a general solution. We will disable focusing input element on clicking the title if markdown is used. I am going to work on it right now.

@MrKrabat @josvanderzalm I have fixed the issue. It was an error in our code in click function.

Thank you,
Andrew

Was this page helpful?
0 / 5 - 0 ratings

Related issues

faso picture faso  路  4Comments

testweird123 picture testweird123  路  4Comments

dmitrykurmanov picture dmitrykurmanov  路  3Comments

dmitrykurmanov picture dmitrykurmanov  路  3Comments

spertusatti picture spertusatti  路  3Comments