react-native-render-html icon indicating copy to clipboard operation
react-native-render-html copied to clipboard

When <strong> tag parent is <a> tag - the render is only Bold text without it been a link as well

Open obiwankenoobi opened this issue 2 years ago • 8 comments

Decision Table

  • [X] My issue does not look like “The HTML attribute 'xxx' is ignored” (unless we claim support for it)
  • [X] My issue does not look like “The HTML element <yyy> is not rendered”

Good Faith Declaration

  • [X] I have read the HELP document here: https://git.io/JBi6R
  • [X] I have read the CONTRIBUTING document here: https://git.io/JJ0Pg
  • [X] I have confirmed that this bug has not been reported yet

Description

When trying to render tag with parent, I assuming the text inside will be bold link. Instead is just a bold text

code example:

<a href=\"https://google.co.il/" target=\"_blank\" rel=\"nofollow noopener noreferrer\">
  <strong>Text</strong>
</a>

React Native Information

"react-native": "0.67.4"

RNRH Version

6.3.4

Tested Platforms

  • [X] Android
  • [X] iOS
  • [ ] Web
  • [ ] MacOS
  • [ ] Windows

Reproduction Platforms

  • [X] Android
  • [X] iOS
  • [ ] Web
  • [ ] MacOS
  • [ ] Windows

Minimal, Reproducible Example

code example:

<a href=\"https://google.co.il/" target=\"_blank\" rel=\"nofollow noopener noreferrer\">
  <strong>Text</strong>
</a>

Additional Notes

No response

obiwankenoobi avatar Mar 22 '23 08:03 obiwankenoobi

@obiwankenoobi Why are quotes escaped in your snippet?

jsamr avatar Mar 22 '23 16:03 jsamr

Hi @jsamr, I work with @obiwankenoobi. That’s a good question regarding the escaping – not sure, we get it like this from the server. But is it relevant to the style issue? Because functionally-wise, the tag does work – the link is recognized

oferRounds avatar Mar 23 '23 19:03 oferRounds

@oferRounds @obiwankenoobi You may try this snippet in AST explorer using htmlparser2 (used by this library) here: https://astexplorer.net/#/2AmVrGuGVJ

You will notice the attributes include quotes, so the URL is evaluated as the following literal: \"https://google.co.il/"; because this is an invalid URI, the renderer does not show the link as clickable. This is all expected.

image

jsamr avatar Mar 24 '23 10:03 jsamr

Notice also that the functionality does work on this case: the text is clickable and the link gets opened correctly, just style is missing

oferRounds avatar Mar 29 '23 23:03 oferRounds

OK, will have a second look at this when I find the time.

jsamr avatar Mar 30 '23 10:03 jsamr

Thank you @jsamr!

oferRounds avatar Mar 30 '23 10:03 oferRounds

hi @jsamr just checking if maybe got to have a look on this one? :)

oferRounds avatar May 03 '23 16:05 oferRounds